English
<jar jarfile="${dist}/myproject.jar" basedir="${build}"/>
</target>
<target name="clean" description="Clean build files">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Ant build file consists mostly of targets, which are collections of steps needed to accomplish intended task. They usually depend on each other and are generally similar to Makefile targets. Available targets can be listed by invoking `ant -p` in project directory containing `build.xml` file. If the file is named differently than `build.xml` you have to tell Ant which file should be used by using `-f` option with the name of the actual build file.
Some projects that use Apache Ant also use Apache Ivy to simplify dependency handling. Ivy is capable of resolving and downloading artifacts from Maven repositories which are declaratively described in XML. Project usually contains one or more `ivy.xml` files specifying the module Maven coordinates and its dependencies. Ivy can also be used directly from Ant build files. To detect whether the project you wish to package is using Apache Ivy, look for files named `ivy.xml` or nodes in the `ivy` namespace in project's build file.
Make
While unlikely, it's still possible that you encounter a project whose build is managed by plain old Makefiles. They contain a list of targets which consist of commands (marked with tab at the begining of line) and are invoked by `make` _target_ or simply `make` to run the default target.
Quiz for Packagers
At this point you should have enough knowledge about Java to start packaging. If you are not able to answer following questions return back to previous sections or ask experienced packagers for different explanations of given topics.
What is the difference between JVM and Java?
What is a CLASSPATH environment variable and how can you use it?
Name two typical Java build systems and how you can identify which one is being used
What is the difference between `java` and `javac` comands?
What are contents of a typical `JAR` file?
What is a pom.xml file and what information it contains?
How would you handle packaging software that contains `lib/junit4.jar` inside source tarball?
Name at least three methods for bundling code in Java projects