You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Serge Corbucci <sc...@questel.fr> on 2003/12/15 19:24:20 UTC
Jar which includes other
I have numerous EJBs, with each EJB named "Foo" associated to the generated
"Foo-client-fooversion.jar" artifact (thanks to ejb:client). I had to merge
these client jar into only one 'client-all" jar. I did the following :
1) create a new POM file referencing all the jars you need to merge as
dependencies. I named it "make-client.xml".
2) add this to your maven.xml :
<!--
Make a global client jar
-->
<goal name="clientejb-all">
<delete dir="target/client-all" />
<mkdir dir="target/client-all" />
<!-- Unjar each dep to our working dir -->
<j:forEach var="lib" items="${pom.artifacts}">
<unjar
dest="target/client-all"
src="${lib.path}"/>
</j:forEach>
<!-- Jar it up -->
<jar
basedir="target/client-all"
jarfile="${maven.build.dir}/${maven.final.name}.jar" />
<delete dir="target/client-all" />
</goal>
3) launch "maven -p make-client.xml clientejb-all
Now you have in your target directory a jar which is the merge result of all
your dependencies. The jar name is the "id" given in make-client.xml.
Hope this helps :)
Serge
-----Original Message-----
From: Brett Porter <bp...@f2network.com.au>
Subject: Jar which includes other
Date: Fri, 26 Sep 2003 08:39:01 +1000
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C383B5.D0B814F0"
Take a look at the uberjar plugin.
- Brett
> -----Original Message-----
> From: Brent Hale [mailto:brent@eventronix.com]
> Sent: Friday, 26 September 2003 1:53 AM
> To: Maven Users List
> Subject: Re: Jar which includes other
>
>
> I don't if this is the BEST way, but here's something I do
> that works.
>
> <postGoal name="jar:jar">
> <attainGoal name="mergejars"/>
> </postGoal>
>
> <goal
> name="mergejars"
> description="Merges the subproject's jar into this main one.">
>
> <!-- Use Ant's zip feature to merge the created jar with the
> schema jar -->
> <ant:zip destfile="${maven.build.dir}/combined.jar"
> duplicate="preserve">
> <zipgroupfileset dir="${maven.build.dir}"
> includes="${maven.final.name}.jar"/>
> <zipgroupfileset dir="qbxmlschema/target"
> includes="*.jar"/>
> </ant:zip>
>
> <!-- Rename the combined.jar as the real one. -->
> <move file="${maven.build.dir}/combined.jar"
> tofile="${maven.build.dir}/${maven.final.name}.jar"/>
> </goal>
>
>
> This shows how to merge two jars into one.
>
> Brent
>
>
>
> Nicolas.CHALUMEAU@arsoe-trelaze.com wrote:
>
> >I don't know if it is possible :
> >
> >I have some sub project which produce jars. This jars are dependant
> >each
> >other.
> >I want to define an other sub project who include the other
> projects jars
> >to build one unique jar.
> >
> >Nicolas
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
> --
> Brent Hale
> Fishbowl Inventory
> www.fishbowlinventory.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org