On 2/12/2011 4:29 PM, Arne Vajh?j wrote:
On 12-02-2011 17:10, Roedy Green wrote:
Manually including them is easy. The problem is remembering to add the
lines to your ant script, or people using library code you write
remembering to add them.
You want to create a tool for people that:
1) change source in projects
2) forget to update the build file appropriately
I took a look at the <jar> task for any. There doesn't seem to be a way
to do EXACTLY what Roedy wants, but there's a pretty easy work-around.
Just use two <jar> tasks, the second of which is an update.
So if your .class files go to build/classes/, and your source file
directory is named src/, you can just use this pair of <jar> tasks:
<jar destfile="dist/Some.jar" basedir="./build/classes" />
<jar destfile="dist/Some.jar" basedir="./src"
excludes="**/*.java **/package.html"
update="true" />
The second task is an update. It excludes all *.java (source) files as
well as the older style package.html Javadoc tool file. It includes
everything else, which is the way most IDEs work and is very convenient.
Don't have to remember to add anything to your build file, it just grabs
everything that you've added to your source tree.
Caveat: lightly tested.
directory before calling <jar>. This doesn't cause any unnecessary work