A
Andy Dingley
I've worked this bit out:
<jar jarfile="${dist}/${ant.project.name}.jar">
<fileset dir="${build}"}/>
<fileset dir="resources" includes="**/*.jpg"/>
</jar>
Couple of hints:
* Ant coding practice (at least our local flavour of it) likes to be
verbose. Verbose and simple works when concise either doesn't, or even
worse it _might_ not (according to the phase of the moon). Ant's worst
problem is the non-obviousness of how it interprets things - you make
one tiny change, all hell breaks loose and it's really not obvious
why.
* Use properties throughout.
* Use structured names on these properties ${build.dir} and $
{component-foo.jar.file} etc. Yes, it's Hungarian notation through
the back door, but Ant doesn't have a useful type system so you're out
on your own here and need the help.
* Use location when setting (filesystem related) properties rather
than value. This is especially important if you're cross platform
Windows/Unix. Ruthlessly avoid putting hard-coded directory separators
into value properties, or at least use the system property $
{file.separator} if you do so.
* Split the build process down into small stages and keep them
separate. You might make .class files, then .jars, then .wars,
then .ears, finally a .zip for shipping. Rather then slapping
everything into dist, keep the sub-sections of build distinct in their
own sub-tres. Don't be afraid to "waste" effort copying tree fragments
around, conceptually simple and robust trumps "optimized" every time
with Ant.