I am new to Ant scripts.
below is description of requirement
in my workspace, there are various projects and I have to have my project work on RAD and eclipse IDE as well as Websphere , tomcat and jboss environment.. i have made project specific settings to make the project work on RAD and websphere and eclipse and tomcat n jboss..
but there are changes in several files like classpath n few config files.
this leaves me with three versions of workspace.
but my idea is to have one workspace with multiple version of classpath for eg. classpath_eclipse, classpath_rad etc.. and have an ant script that will choose between the right files during build depending on which ide.
So guys please suggest some approach how can i implement this approach. totally new to ant. .:/
I would like to share the approach that I finally implemented.
There were
classpath
,settings
and someproject config xmls
that were dependent on runtime.In each project we created a
runtime_classpah
&runtime_settings
andconfigxml_runtime
version of each file.Created a
target
inant
that takes inruntime
as param ,itrates over each project & copies contents ofclasspath_runtime
toclasspath
,setting_runtime to settings
.And a target that overrites
configxml
with contents ofconfigxml_runtime
I'd suggest using Apache ivy for managing complex classpaths. It externalizes your build dependencies into a separate ivy.xml file.
Secondly, ivy can automatically download such dependencies, reducing the size of your project under source control.
Finally, this solution at first glance might appear horribly complex. It's advantage is that it's compatible with other build technologies such as Maven.
Example
ivy.xml
Ivy uses "configurations" to manage logical groupings of jars.
In this example the code compiles against the SLF4J api jars, but at run-time use different logging implementations:
Notes:
build.xml
The ivy ANT tasks are imported as an antlib. The ivy cachepath task is used to turn an ivy managed configuration into normal ANT paths and the ivy report task produces a dependency report.
The ivy retrieve task is used to populate a directory during your application's packaging phase:
IDE configuration files
An Eclipse plugin for ivy is available.
It's also possible to generate IDE configuration files using an embedded groovy task. Following is an Eclipse example: