tags:

views:

100

answers:

3

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?

+3  A: 

The ant manual and ANT Tutorial would be the best places to start.

jsight
i am using the above command only for creating jars, but i also want the projects to get compiled somehow..??
Mrityunjay
+2  A: 

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>
rodrigoap
+1  A: 

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]

Dan Dyer