ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Pringle <Jas...@captura.com>
Subject RE: <jar> and <fileset> problems...
Date Thu, 08 Mar 2001 02:59:50 GMT
Ahh, got it.  After your added explanation, the docs seem more clear.

Thanks!

-----Original Message-----
From: Glenn McAllister [mailto:glenn@somanetworks.com]
Sent: Wednesday, March 07, 2001 6:32 PM
To: ant-user@jakarta.apache.org
Subject: Re: <jar> and <fileset> problems...


The jar task uses an implicit fileset.  The basedir attribute is equivalent
to
the <fileset dir=...> element, and the include and exclude attribute are
(basically) equivalent to <fileset dir=...><include name="..."/></fileset>.

Jason Pringle wrote:

> Working target:
>
>   <target name="system" depends="compile-system"
>           description="Creates the system JAR file">
>     <jar jarfile="${deploy.dir}/jars/captura/system_gen.jar"
>          basedir="${build.dest}"
>          compress="no">
>              <include name="${system.pkg.dir}/common/**"/>
>     </jar>

This works because its including all the ${system.pkg.dir}/common/** files,
starting at ${build.dest}.

> Non-working targets:

<snip/>

>   <target name="system" depends="compile-system"
>           description="Creates the system JAR file">
>     <jar jarfile="${deploy.dir}/jars/captura/system_gen.jar"
>          basedir="${build.dest}"
>          compress="no">
>          <fileset dir="${build.dest}">
>              <include name="${system.pkg.dir}/common/**"/>
>          </fileset>
>     </jar>

This (and the one before it) doesn't work becuase you are declaring the same
set of files twice.  You are telling the jar task to take all the files in
basedir (${build.dest}) on down, and add them to the jar.  Then, with the
nested fileset, you are saying "Include all the ${system.pkg.dir}/common/**
files, starting from the ${build.dest} directory."  So you *are* in fact
including the ${system.pkg.dir}/common/** files twice.

If you want to use filesets, don't use the basedir attribute would be a good
rule of thumb.

Glenn


Mime
View raw message