You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by sthakor <sa...@yahoo.com> on 2013/03/13 23:54:22 UTC

Re: Create WEB-INF/lib based on path-structure

i went through a bunch of posts and did not find the answer.  Finally i
solved it as explained below.  my way is possibly a little verbose but it
does the job.  SO my goal was to be able to include my libs(.jar files)
which are in some third party dir referenced by $3rdParty-libs, into the
WEB-INF/lib directory.  Also the structure of my 3rd-party-libs is:
 /...../
        -3rd-party-libs/
             - cometd-2.4.3/ 
                  - bunch of .jar files
             - commons-lang3-3.1/
                  - bunch of .jar files
             - restlet-jee-2.1.2/
                  - bunch of .jar files

     So in addition to getting all the required jar files under my war's
WEB-INF/lib directory i did NOT want the directory structure of these jar
files to be carried over 
    i.e  i did NOT want  WEB-INF/lib/cometd-2.4.3/<someCometd>.jar
i wanted it like: WEB-INF/lib/<someCometd>.jar

so the simple solution is to specify the war task's <lib> nested element
multiple times.  Once per directory that you want to reference inside your
3rd-party-libs directory.

Here is my war target:
================
    <target name="war" depends="compile">
        <war destfile="dist/waisApp.war" webxml="WebContent/WEB-INF/web.xml"
update="true">
            <lib dir="${3rd-party-libs}/cometd-2.4.3/">
                <include name="*.jar"/>
            </lib>
        	<lib dir="${3rd-party-libs}/commons-lang3-3.1/">
                <include name="*.jar"/>
            </lib>
        	<lib dir="${3rd-party-libs}/restlet-jee-2.1.2/">
                <include name="*.jar"/>
            </lib>
            <fileset dir="WebContent"/>
            <classes dir="build/classes"/>
        </war>
    </target>



--
View this message in context: http://ant.1045680.n5.nabble.com/Create-WEB-INF-lib-based-on-path-structure-tp1350348p5713953.html
Sent from the Ant - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Create WEB-INF/lib based on path-structure

Posted by Martin Gainty <mg...@hotmail.com>.
Yep that will package spurious jars into a new uber-war...BTW in maven you could use <dependency-management> to accomplish this objective
Glad to hear you got this problem solved..thanks for the info
Martin > Date: Wed, 13 Mar 2013 15:54:22 -0700
> From: sanjiv_thakor@yahoo.com
> To: user@ant.apache.org
> Subject: Re: Create WEB-INF/lib based on path-structure
> 
> i went through a bunch of posts and did not find the answer.  Finally i
> solved it as explained below.  my way is possibly a little verbose but it
> does the job.  SO my goal was to be able to include my libs(.jar files)
> which are in some third party dir referenced by $3rdParty-libs, into the
> WEB-INF/lib directory.  Also the structure of my 3rd-party-libs is:
>  /...../
>         -3rd-party-libs/
>              - cometd-2.4.3/ 
>                   - bunch of .jar files
>              - commons-lang3-3.1/
>                   - bunch of .jar files
>              - restlet-jee-2.1.2/
>                   - bunch of .jar files
> 
>      So in addition to getting all the required jar files under my war's
> WEB-INF/lib directory i did NOT want the directory structure of these jar
> files to be carried over 
>     i.e  i did NOT want  WEB-INF/lib/cometd-2.4.3/<someCometd>.jar
> i wanted it like: WEB-INF/lib/<someCometd>.jar
> 
> so the simple solution is to specify the war task's <lib> nested element
> multiple times.  Once per directory that you want to reference inside your
> 3rd-party-libs directory.
> 
> Here is my war target:
> ================
>     <target name="war" depends="compile">
>         <war destfile="dist/waisApp.war" webxml="WebContent/WEB-INF/web.xml"
> update="true">
>             <lib dir="${3rd-party-libs}/cometd-2.4.3/">
>                 <include name="*.jar"/>
>             </lib>
>         	<lib dir="${3rd-party-libs}/commons-lang3-3.1/">
>                 <include name="*.jar"/>
>             </lib>
>         	<lib dir="${3rd-party-libs}/restlet-jee-2.1.2/">
>                 <include name="*.jar"/>
>             </lib>
>             <fileset dir="WebContent"/>
>             <classes dir="build/classes"/>
>         </war>
>     </target>
> 
> 
> 
> --
> View this message in context: http://ant.1045680.n5.nabble.com/Create-WEB-INF-lib-based-on-path-structure-tp1350348p5713953.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>