How can I reference classpathref in a military task?
I declare the following classpath link for my librairies applications:
<path id="libraries"> <fileset dir="${lib.dir}" includes="**/*.jar" /> </path > I can compile the code using the librairies class path:
<javac srcdir="${src}" destdir="${build.classes}" classpathref="libraries"/> But I cannot find a way to include a set of librairies files in my WAR file as well:
<war destfile="${release.dir}/rel.war" webxml="${webinf}"> <classes dir="${build.classes}"/> <!-- I need to copy paste the same directory declaration! --> <lib dir="${lib.dir}" includes="**/*.jar"/> </war> How can I replace the lib declaration with one that reuses the same path as in my javac task?
Declare a fileset from path and give it an identifier:
<fileset id="xxx" dir="..." includes="..." /> Then specify the identifier in both declarations ( lib indicates a set of files, so you do not need to use nesting):
<path id="libraries"> <fileset refid="xxx"/> </path> ... <lib refid="xxx"/>