ANT: How to specify multiple files at once (to a jar target) ?

T

Thomas Stien

I want to add a couple of files to a jar archive with the ANT built tool.
The files are spread over three different directories.
Simplified the situation is as follows:

1.) Include all files from directory ${blah} and its subdirectories
2.) Include exactly the files karl.txt and paul.txt from directory ${test}
3.) All files from directory ${myproj} (but NOT its subdirectories)
except the file log.dat

Can I achieve this with ONE jar target with three filesets?
The following doesn't work. The first part is collected successfully
but there are differences with the latter two. The files from the second
part are not included whereas the files from the subdirectories are
included in the third part.

How can it be done better?
(All files are existing)

<target name="bbb" description="Build test jar file" depends="aaa">
<jar destfile="mytest.jar">
<fileset dir="${blah}" />
<fileset dir="${test}" >
<filename name="**/karl.txt" />
<filename name="**/paul.txt" />
</fileset>
<fileset dir="${myproj}" excludefile="${myproj}/log.dat" />
</jar>
</target>

Thomas
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top