Play@Work

Saturday, March 05, 2005

Java development With Ant.

Was lookin thru this book - "Java development with Ant - Erik Hatcher, Steve Loughran". Pretty neat.
duh !!
Did you know what the full form of ANT is ??? - Another Neat Tool !!!

Picked up a few things from the one chapter that I read.

We can have one Build File per project. But then we can also break up the poject into sub-projects and have multiple build files for each sub-project.
(one - many mapping)
Project - multiple Targets
Target - Multiple Tasks

where Task is an actual reference to a Java class built into Ant that understands the parameters in the build file and can execute a particular task
We can extend these tasks (or reuse others tasks). One of the main reasons why ANT is so powerful. And Java makes it platform independent.

For (a task in ANT which compiles java code) task's Source Dependency checking to work, we must lay out the source in a directory tree matching the package declarations in the source.
- So basically if ant is recompiling the java files everytime then maybe the project hierarchy is not rite ! (dependency checking of is limited to comparing the dates on the 2 files. So if it does not find the source files in the specified package as mentioned, then it just assumes that we dont have an up-to-date version of the compiled file.) Definitely not an issue with the IDEs that we use I guess.

ant -projecthelp
returns the various targets in a build file with the description of what they do if entered in the build file.

There was also an section on how Cruise control uses ANT to do its stuff. Looked interesting, didnt check that out though.

11 Comments:

Post a Comment

<< Home