Java Reference
In-Depth Information
Using Ant for both compiling and packaging
Alternatively, you can rely exclusively on Ant for all your build requirements,
including compilation duties. With this approach, you abandon the built-in
compiler and use Ant as your exclusive build mechanism. This has the benefit
of completely decoupling your build process from the IDE and ensuring that
you can continue to produce automated builds and support various develop-
ment environments.
The primary downside to this approach is a decrease in speed, especially with
large projects. Not only must Ant scan your entire project before compiling to
determine which files have changed, but after the build, IDEA must resynchronize
its file cache to learn what files Ant has introduced or updated. In addition, over-
head is associated with starting and executing the Ant process. And, there is no easy
way to force Ant to compile an individual file if necessary. The effects of this behav-
ior on the speed of your build vary from system to system and project to project.
Supporting compilation in either Ant or IDEA as necessary
A combination of the two ant-integration approaches, this option means a little
more work but provides the most flexibility. The basic idea is to use both Ant's
and IDEA 's compilation features along with Ant's packaging and deployment
capabilities, to achieve the best of both worlds. When it's necessary or convenient
to build outside of IDEA with Ant (such as when you're executing a nightly build),
do so. When you're running IDEA , however, feel free to enjoy the speed and con-
venience of its internal project builder. In either case, Ant remains in charge of
other build tasks.
The complication is making sure that IDEA and Ant don't step on each other's
toes. One way to do this is to have Ant and IDEA use different output paths for
compiling their files, ensuring that the two build mechanisms remain separate. If
necessary for your packaging process, create additional Ant targets designed to
be called from IDEA in order to prepare files for packaging. You can simplify the
matter if you rely on Ant to do everything for your final package builds, compila-
tion and all, using IDEA 's compiler only during daily development.
5.2.3
Working with Ant build files
To do anything with Ant through IDEA , you must have an Ant build file that
defines the steps required to build your project. IDEA can be used to create new
Ant build files as well as work with ones from existing projects.
 
 
 
 
 
 
 
Search WWH ::




Custom Search