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

Discussion in 'Java' started by Thomas Stien, Oct 18, 2004.

  1. Thomas Stien

    Thomas Stien Guest

    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
    Thomas Stien, Oct 18, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    553
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,688
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,722
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
  5. DaveJ
    Replies:
    1
    Views:
    933
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=
    May 19, 2007
Loading...

Share This Page