Good template build.xml

I’m currently working on a demonstration application to show interested parties (and blog readers) how to tie j2ee applications together with some simple xdoclet and ant. There are plenty of great examples for the java source files. However the build.xml files are usually somewhat daunting.

What I’m looking for now is a relatively ‘standard’ build.xml and corresponding directory structure to make this all much easier.

Something like

  • Seperate directories for the various sources. One for EJBs, one for struts classes, another for POJOs (some of which will be hibernate mapped).
  • Ant targets to run xdoclet where applicable and build them all
  • Targets to produce the ejb jar files, the war files and then the EAR file.
  • lib directories for jars that are required at build time, and deploy time.

To start with I went to the same code that taught me struts, Matt Raible’s AppFuse and the Roller weblogger. However both of these have build files that are fairly heavy going. I don’t want to scare anyone off.

I think I may start with the sample build.xml from xdoclet and go from there. However if anyone else has a good suggestion for directory layout and build files I’d be glad to hear it.

Posted on July 13th, 2003 | 6 comments | Commenting Closed
Bob Stine

Bob Stine July 13th, 2003 @ 12:54 PM

I don’t know whether it’s still available, but about nine months ago there was an example download from JBoss that used xdoclets.

Bob Stine

Bob Stine July 13th, 2003 @ 01:22 PM

See http://prdownloads.sourceforge.net/jboss/JBoss.3.0TemplateAndExamples.zip?download for the JBoss template example

Jeff Gunther

Jeff Gunther July 14th, 2003 @ 04:04 AM

Check out Erik Hatcher’s JavaDevWithAnt!

http://www.ehatchersolutions.com/JavaDevWithAnt/

Matt Raible

Matt Raible July 16th, 2003 @ 04:34 PM

Just as an FYI, my AppFuse app is based on Erik Hatcher’s JavaDevWithAnt as far as build.xml and the directory structure is concerned. Why re-invent the wheel? It may be heavy at first glance, but you could probably remove checkstyle, pmd and other such tasks and simplify it a lot. Also, the “new” task isn’t really needed. I could trim it up a bit and send you a bare-bones version that would do XDoclet, JUnit, Cactus, etc.

James

James July 16th, 2003 @ 10:04 PM

I would use the build file that comes with httpunit. It well written and can be easily extended for whatever reason. Check it out: http://www.httpunit.org

Alex

Alex July 17th, 2003 @ 10:21 PM

what about Maven (http://maven.apache.org/)? I think it’s still not quite ready, but it has a fair amount of stuff already completed.

Sponsors

Hosted excellently by RailsMachine