ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject Re: pathtofileset or fileset referencing path
Date Wed, 15 Nov 2006 22:55:37 GMT

The solution to this is usually to use a <flattenmapper/>.  The only problem is
that one usually uses that with the <copy/> task.  I'm not sure how you would
use it directly with the <war/> task.

You could copy all the files to one directory and then use a fileset of the
files in the new directory.  This is actually what I do.  I don't use the
<war/> task.  I create a directory structure exactly represents my WAR file.  I
use it for both development and to simply run the <jar/> task on the directory
structure to build the WAR file.  It keeps the build file simple.


Quoting Jennifer Yang <>:

> Hi,
> I would like to define set of dependent libraries for compile and
> reuse the list for creating a war.  I have seen posts recommending the
> use of pathtofileset.  It looked good except that the resulting war
> contained the relative paths to the dependent libs.
> We have a repository of all the thirdparty libs: e.g.
> <THIRD_PARTY>/lib/oracle/*.jar
> <THIRD_PARTY>/lib/mysql/*.jar
> <THIRD_PARTY>/lib/apache.commons/*.jar
> For compile, I have set up a path: e.g.
>     <path id="">
>         <fileset dir="<THIRD_PARTY>/lib/oracle">
>             <include name="*.jar" />
>         </fileset>
>         <fileset dir="<THIRD_PARTY>/lib/apache.commons">
>             <include name="*.jar" />
>         </fileset>
>         ...
>     </path>
> Then for the war target, I have:
>    <pathtofileset name="war.lib.thirdparty"
>                                pathrefid=""
>                                dir="${THIRDPARTY_HOME}/lib"/>
>     <war warfile="mywarfile.war" webxml="${war.webxml}">
>         <zipfileset refid="war.lib.thirdparty" prefix="WEB-INF/lib">
>         ...
>     </war>
> This produces war contents as:
>     WEB-INF/lib/apache.commons/commons-dbcp-1.2.1.jar
>     WEB-INF/lib/apache.commons/commons-pool-1.2.jar
>     WEB-INF/lib/apache.commons/commons-validator-1.3.0.jar
>     WEB-INF/lib/oracle/classes12.jar
> How can I get rid of the "apache.commons" and "oracle" prefixes above?
> What is a good way to define dependencies in one place and reuse?
> Thanks,
> Jennifer
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message