You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Olivier Gies <ol...@bull.net> on 2008/09/22 06:23:24 UTC

Tuning multi-module assembly

Hi everyone,

I have a multi-module project as follows:

my_project
|
+- myapp1 (war)
|
+- myapp2 (war)
|
+- myutils (jar)

I want to assemble "my_project" as follows:

my_project.zip
|
+- applications/
|  |
|  +- myapp1.war
|  |
|  +- myapp2.war
|
+- lib/
   |
   +- myutils.jar
   |
   +- *.jar (JAR dependencies of myapp1, myapp2 and myutils)


So far, I could successfully put the WARs in applications/ and the JAR 
in lib/ using <moduleSets>, but there are still some side-effects I wish 
to prevent:

1) How to prevent WAR plugin from putting each war's dependent JARs into 
the myappX.war:WEB-INF/lib ?
2) How to put those JARs into the parent's (my_project) target assembly 
lib/ directory instead ?
3) How to limit execution of assembly plugin to my_project ? i.e. 
prevent its execution for each individual module

Thanks for your insights.

-- 

*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of 
the intended recipient. Any review, reliance or distribution by others 
or forwarding without express permission is strictly prohibited. If you 
are not the intended recipient, please contact the sender and delete all 
copies.*


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Tuning multi-module assembly

Posted by Olivier Gies <ol...@bull.net>.
I actually solved my 3 questions, so I will give my solutions hereunder 
if anyone is also interested:

1) See this page from maven-war-plugin: 
http://maven.apache.org/plugins/maven-war-plugin/examples/skinny-wars.html

If config element <packagingExcludes> doesn't work, just use 
<warSourceExcludes> as indicated for deprecated version

2) Use <moduleSets> with following basic config:
     ...
     <moduleSet>
       <includes>
         <include>mypack:myapp1</include>
       </includes>
       <binaries>
         <includeDependencies>true</includeDependencies>
         <unpack>false</unpack>
         <useDefaultExcludes>true</useDefaultExcludes>
         <outputDirectory>lib</outputDirectory>
       </binaries>
     </moduleSet>
     ...

3) Set <inherited> element to 'false' under assembly <plugin> element

Regards,

*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of
the intended recipient. Any review, reliance or distribution by others
or forwarding without express permission is strictly prohibited. If you
are not the intended recipient, please contact the sender and delete all
copies.*

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Tuning multi-module assembly

Posted by Olivier Gies <ol...@bull.net>.
 > 3) I tried to set the "inherited" element to 'false', but it seems
 > assembly for modules still occurs... any idea why this is the case?

Never mind that, I actually set the <inherited> element at the <plugin> 
level, and now the assembly won't occur for modules, as desired...

BR,
Olivier

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Tuning multi-module assembly

Posted by Olivier Gies <ol...@bull.net>.
Thanks Samuel,

 >> 1) How to prevent WAR plugin from putting each war's dependent JARs 
into the
 >> myappX.war:WEB-INF/lib ?
 >
 > 1 - Use the "provided" scope for all your war dependencies, see
 > 
http://maven.apache.org/ref/current/maven-model/maven.html#class_dependency
 > and 
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope

1) I already tried using "provided" has the dependency scope, but some 
dependencies require their transitives on the compile classpath, so that 
"compile" scope is required...

 >> 3) How to limit execution of assembly plugin to my_project ? i.e. 
prevent
 >> its execution for each individual module
 >
 > 3 - You can use the "inherited" flag on your assembly execution, see
 > 
http://maven.apache.org/ref/current/maven-model/maven.html#class_execution

3) I tried to set the "inherited" element to 'false', but it seems 
assembly for modules still occurs... any idea why this is the case?

Thanks

*Olivier Gies*

*Delivery Manager
Customs & Tax Software Engineering Center
Bull, Architect of an Open World ^TM
Phone: +86 (10) 65978001 - Ext 555 *

*www.bull.com <http://www.bull.com/>*

*This e-mail contains material that is confidential for the sole use of
the intended recipient. Any review, reliance or distribution by others
or forwarding without express permission is strictly prohibited. If you
are not the intended recipient, please contact the sender and delete all
copies.*

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Tuning multi-module assembly

Posted by Samuel Le Berrigaud <sa...@gmail.com>.
Hi Olivier,

I don't have the answer to all your questions but I believe I can help
with questions 1 & 2:

1 - Use the "provided" scope for all your war dependencies, see
http://maven.apache.org/ref/current/maven-model/maven.html#class_dependency
and http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
3 - You can use the "inherited" flag on your assembly execution, see
http://maven.apache.org/ref/current/maven-model/maven.html#class_execution

Hope this helps,
SaM

On Mon, Sep 22, 2008 at 2:23 PM, Olivier Gies <ol...@bull.net> wrote:
> Hi everyone,
>
> I have a multi-module project as follows:
>
> my_project
> |
> +- myapp1 (war)
> |
> +- myapp2 (war)
> |
> +- myutils (jar)
>
> I want to assemble "my_project" as follows:
>
> my_project.zip
> |
> +- applications/
> |  |
> |  +- myapp1.war
> |  |
> |  +- myapp2.war
> |
> +- lib/
>  |
>  +- myutils.jar
>  |
>  +- *.jar (JAR dependencies of myapp1, myapp2 and myutils)
>
>
> So far, I could successfully put the WARs in applications/ and the JAR in
> lib/ using <moduleSets>, but there are still some side-effects I wish to
> prevent:
>
> 1) How to prevent WAR plugin from putting each war's dependent JARs into the
> myappX.war:WEB-INF/lib ?
> 2) How to put those JARs into the parent's (my_project) target assembly lib/
> directory instead ?
> 3) How to limit execution of assembly plugin to my_project ? i.e. prevent
> its execution for each individual module
>
> Thanks for your insights.
>
> --
>
> *Olivier Gies*
>
> *Delivery Manager
> Customs & Tax Software Engineering Center
> Bull, Architect of an Open World ^TM
> Phone: +86 (10) 65978001 - Ext 555 *
>
> *www.bull.com <http://www.bull.com/>*
>
> *This e-mail contains material that is confidential for the sole use of the
> intended recipient. Any review, reliance or distribution by others or
> forwarding without express permission is strictly prohibited. If you are not
> the intended recipient, please contact the sender and delete all copies.*
>
>
> ---------------------------------------------------------------------
> 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