Ant question about FilterSets

D

danharrisandrews

Danno said:
Do you know of a way of using FilterSets with the war, or jar task?

Yes you can specify a fileset. See these links:
http://ant.apache.org/manual/CoreTasks/jar.html or
http://ant.apache.org/manual/CoreTasks/war.html

However, typically I do a fresh ant build and then include everything
in the classes directory. In my make target I can fuss about which
classes and files to include and exclude. Here are my slightly edited
jar and make targets for another example apart from the ant manual.

<target name="jar" depends="init,clean,make">
<delete file="${jar.dir}/myjar.jar" />
<jar destfile="${jar.dir}/myjar.jar" basedir="./classes">
<manifest>
<attribute name="Built-By" value="${user.name}" />
<attribute name="Main-Class" value="mypackage.MyMainClass"/>
<attribute name="Class-Path" value="." />
</manifest>
</jar>
</target>

<target name="make" depends="init">
<copy todir="${classes.dir}">
<fileset dir="${source.dir}">
<include name="**/*.properties" />
<include name="**/*.gif" />
<include name="**/*.jpg" />
<include name="**/*.png" />
<include name="**/*.txt" />
</fileset>
</copy>
<javac destdir="${classes.dir}" optimize="off" debug="on"
target="1.5" source="1.5">
<src path="${source.dir}" />
<exclude name="**/Test.java" />
<compilerarg line="-Xlint" />
</javac>
</target>

Cheers,

Dan Andrews
- - - - - - - - - - - - - - - - - - - - - - - -
Ansir Development Limited www.ansir.ca
- - - - - - - - - - - - - - - - - - - - - - - -
 
D

Danno

Thanks for the reponse.

Unfortunately, I was needing a "FilterSet" and not a "FileSet" to use
with my jar/war task. They are two different things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,079
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top