ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Problems with <jar> task
Date Fri, 10 Nov 2000 08:42:01 GMT
David Ventimiglia <> 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
> 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"
       <fileset dir="${build.dir}" excludes="**/*Bean.class" />
       <fileset dir="${build.dir}">
          <exclude name="**/*Bean.class"/>

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.


View raw message