Java Reference
In-Depth Information
Figure 9.1
Running the build file from the command line
9.5
Putting Ant to the task
Now that you've assembled the build file, you can run it from the command line by
changing to your project directory and typing ant . Figure 9.1 shows the Ant con-
sole output.
We can now build and test the project at the same time. If any of the tests fail, the
haltonfailure and haltonerror settings will stop the build, bringing the problem to
our attention.
Running the junit optional task
The junit task is an optional component bundled in Ant's ant-junit.jar file, which
should already be in your ${ANT_HOME}/lib directory. Ant doesn't bundle a copy
of JUnit, so you must ensure that junit.jar is on your classpath or in the
${ANT_HOME}/lib directory. The ant-junit.jar file contains the task itself. For more
information on installing Ant, see section 9.3, “Introducing and installing Ant.” If
you have any trouble running the Ant build files presented in this chapter, make
sure the ant-junit.jar file is in the ${ANT_HOME}/lib folder and junit.jar is either on
your classpath or in the ${ANT_HOME}/lib folder.
So far, we've looked at one way to execute tests with Ant. We now look at another
aspect of the build process: dependency management. In order to automate manage-
ment of dependencies for Ant projects, we introduce and use the Apache Ivy 5 project.
5
http://ant.apache.org/ivy/
 
 
 
Search WWH ::




Custom Search