Skip to content
SWP-Comp-Ch3ck3r edited this page Apr 26, 2013 · 1 revision

Ant is a command line tool like make.

The basic commands are:

  • ant - This will execute the default target inside build.xml
  • ant -f other.xml - The -f argument selects the buildfile (build.xml is the default otherwise)
  • ant -p - The -p trigger will show you all available targets
  • ant targetName - This will run the target named targetName

You can combine the parameters as you need.

Our targets

Every project has its own build.xml with the following targets

$ ant -p
Buildfile: /home/frank/swp-compiler/fuc/code/ast/build.xml

Main targets:

 build       compile source code
 build-test  compile the JUnit test classes
 clean       clean compiled classes from ${bin.dir} and javadoc from ${doc.dir}
 doc         generate the javadoc documentation
 run         generate javadoc and run all tests
 run-test    run the JUnit test classes
Default target: run

If you omit the target, run is always the default target.

Ant will resolve dependencies automatically. E.g. if run-tests depends on build-test ant will automatically run build-test when you choose the target run-test.

Dependencies to other projects

Ant needs to know your project dependencies to use the correct class path when compiling your sources. At the moment every component lists the interfaces as a dependencies. If you need more dependencies they need to be added to the ant file. If you know how to do this feel free to edit your ant file. Otherwise just ask for help.

Ant in Eclipse

Ant is a command line tool and intended to be run from your console. Though ant is also integrated into eclipse IDE and can be executed directly from eclipse.

Open the build.xml file in your eclipse project. Select run as Ant Build to execute the default target run. If you want to execute another target, right click it in the Outline View and select run as Ant Build.

antrun