ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ventimiglia, David" <David.Ventimig...@msdw.com>
Subject RE: Problems with <jar> task
Date Fri, 10 Nov 2000 17:15:08 GMT
Excellent!  Thank you very much.  Now, all is clear.

Cheers,
David

-----Original Message-----
From: Stefan Bodewig [mailto:bodewig@bost.de]
Sent: Friday, November 10, 2000 12:42 AM
To: ant-user@jakarta.apache.org
Subject: Re: Problems with <jar> task


David Ventimiglia <David.Ventimiglia@msdw.com> wrote:

> I'm getting many instances of this sort of error when trying to use
> the <jar> task:
> 
> Building jar: C:\deploy_root\foo.jar
> 
> BUILD FAILED
> 
> m:\dventimiglia_coreFoo_V1_integration\coreFoo\build.xml:165:
> Problem creating jar: duplicate entry:
> com/foo/online/aba/metro/AccountData.class

> This happens when I try to use nested <fileset> elements with
> internally nested <include> and <exclude> elements, as in:
> 
>   <target name="jar" depends="init,classes">
>     <jar jarfile="${deploy.root}/foo.jar"
>          basedir="${build.dir}"
>          compress="${jar.compress}"
>          excludes="**/*Bean.class">
>       <fileset dir="${build.dir}">
>          <exclude name="**/*Bean.class"/>
>       </fileset>
>     </jar>
>   </target>

The problem here is, that you have two overlapping filesets. When you
specify a basedir, this creates an implicit fileset, i.e. what you
have above is identical to

     <jar jarfile="${deploy.root}/foo.jar"
          compress="${jar.compress}">
       <fileset dir="${build.dir}" excludes="**/*Bean.class" />
       <fileset dir="${build.dir}">
          <exclude name="**/*Bean.class"/>
       </fileset>
     </jar>

You are passing the same files twice to your <jar> task.

> However, it works fine if I remove the nested <fileset> and
> collapse the "exclude" into the JAR task, as in:

Sure, you could as well leave out the basedir and excludes attributes
in the jar tag. Now you are only having one fileset.

Hope this helps.

Stefan

Mime
View raw message