Chapter 6. Executing programs
This chapter covers:
So far, our code compiles and the tests pass. Ant is packaging it into JAR files and then into Zip and tar packages for distribution.
This means it’s time to explore the capabilities of Ant to execute programs, both Java and native. Ant is one of the best tools for starting programs in Java; it wraps all the platform-specific details into a few tasks. It’s so useful that it’s often used behind the scenes in many applications.
Ant’s execution services come in three tasks, <java>, <exec>, and <apply>, that together meet most projects’ needs for running Java and native code. Let’s start with an overview of the problem, get into <java>, and then look at native code.
Ant does a lot of work in its own libraries, in the Java code behind tasks. You don’t need to explicitly run external programs on every line of a build file just to get the application compiled, packaged, and tested the way you’d have to do with the Make tool. Yet eventually, projects need to use external programs.