Re: ant, jar with selected directories



Well, I solved it... The key was in this sentence in the Ant docs for
the jar task:

The extended fileset and groupfileset child elements from the zip task
are also available in the jar task.

Which enabled me to do this:

<property name="top.dir" value="/javasrc"/>
<property name="util.dir" value="my/stuff/util"/>
<property name="Proj1.dir" value="other/stuff/Proj1"/>
<property name="jar.file" value="Proj1.jar"/>

<target name="jar">
<jar destfile="${top.dir}/${jar.file}">
<zipfileset dir="${top.dir}/${jws.dir}" prefix="${util.dir}"
includes="*.class"/>
<zipfileset dir="${top.dir}/${jcw.dir}" prefix="${Proj1.dir}"
includes="*.class"/>
</jar>
</target>

The jar task specifies no contents, and each of the zipfileset elements
specifies a directory, and prepends the path when the files are stored.

cheers,
Dave

.