building java project using ANT utility
Question
I am using an ANT script to build the jars of the projects that I have in my eclipse workspace. The command that I use is ant -f <build_file.xml>
I want to build the projects using the ant script only (at the moment I am using eclipse for the this). Can anyone help me out?
Solution
The ant manual and ANT Tutorial would be the best places to start.
OTHER TIPS
This will compile the Java files in my_prj/src to my_prj/classes using the jars in my_prj/lib.
<javac srcdir="my_prj/src"
destdir="my_prj/classes"
debug="on">
<classpath>
<fileset dir="my_prj/lib">
<include name="**/*.jar"/>
</fileset>
</classpath>
</javac>
Your Ant build script will contain several targets that you can invoke. From the command line use the -p
switch to list those that are available along with their descriptions:
ant -f mybuildfile.xml -p
You can then invoke one of the listed targets:
ant -f mybuildfile.xml sometarget
[Note: the -f
is not necessary if the build file is called build.xml
, as is the usual convention]