Java Reference
In-Depth Information
Ant attempts to solve the same problems as
make
, while avoiding its two biggest
shortcomings: a confusingly ancient syntax and platform dependencies.
Like
make
, Ant relies on a
build file
to direct the actions you wish to perform;
but instead of a shell script, Ant uses a platform independent
XML
file. Unlike
make
, the steps defined in Ant's build file enumerate the logical activities, not
explicate system commands, which must be carried out to build the application.
The platform-independent Ant software takes care of performing the actions,
which it calls
tasks
, regardless of the platform it's running on.
Using Ant with IDEA
As you've learned in this chapter,
IDEA
provides an efficient and easy way to use
system for compiling your projects and modules.
IDEA
tracks dependencies auto-
matically and provides excellent tools for tracking down and resolving compile-
time problems.
IDEA
is more than capable of compiling your project.
However, successfully compiling your project is only the first hurdle. At a mini-
mum, most production applications must be packaged with documentation,
source code, and other components into something distributable to the end user.
Some applications require other more involved steps such as initializing a data-
base, running a local script file, or archiving the previous release. This is where
Ant comes in.
Ant comes bundled with dozens of different tasks you can use to complete or
extend the build process, including the ability to interact with your source code
control system,
FTP
server, and much more. Best of all, Ant is
extensible
; you can
download or create additional tasks if necessary through the Ant
API
. Here are
just a few of the scenarios that Ant can handle:
Copy, delete, and move files
■
Change file permissions on your build output
■
Launch coverage tools like
JP
robe and
JD
epend
■
Run the Javac, Jikes, and Rmic compilers
■
Generate JavaDoc and
XML
/
XSLT
-derived documentation
■
Push files to remote
FTP
or web servers
■
Send email build notifications and log build errors
■
Perform linefeed conversions and text search/replace operations
■
Commit files to revision control systems
■
Execute
SQL
operations to populate databases
■
Control preprocessors like Java
CC
,
ANTLR
, and iContract
■