1

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?

1
  • 1
    Why can't you just run that command from the command prompt? Commented Jan 5, 2010 at 16:58

3 Answers 3

4

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

Sign up to request clarification or add additional context in comments.

1 Comment

i am using the above command only for creating jars, but i also want the projects to get compiled somehow..??
3

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>

Comments

1

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]

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.