You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Adam Gibbons <ad...@gmail.com> on 2011/04/06 16:14:46 UTC

The maven-assembly-plugin and a large complex project.

Hello all,

I'm working on a large aggregate project that I'm trying to build 4 WAR
files for.

What I would like is a top level pom which upon doing mvn package it will
produce my 4 WAR files by compiling all child modules AND jars.
Each WAR file is comprised of a number of modules and some of the multiple
modules have a dependency on in-house compiled jars. Ideally when building
the WARs I'd like all of the child modules and jars built/deployed.
I've spent the whole day reading the assembly plug in documentation, but I
was wondering if anyone had any good real-life working examples of this kind
of thing in action I could look at?

Kind regards!
Adam

Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 6, 2011 at 11:06 AM, Adam Gibbons <ad...@gmail.com> wrote:
> Yes,
>
>  +-- pom.xml
>  +-- m1 (j1, j2)
>  +-- m2 (j3)
>  +-- m3 (j1, j3)
>  +-- m4
>  +-- m5
>  +-- j1
>  +-- j2
>  +-- j3
>  +-- war1 (m1,m2,m3)
>  +-- war2 (m4)
>  +-- war3 (m5)
>
> This setup is effectively what I have so far.
> However I am unable to use parent on a number of modules (as some have more
> than 1). On reading the doco I don't believe this actually matters.

Each pom should have a <parent> pointing to the pom in the directory
above it.  That pom should have <modules> pointing down to its
subdirectories.

Whatever you're doing that makes you think a module has more than one
parent is likely the cause of the confusion.

> Am I right in thinking that the root pom only need include the war modules
> and everything else should be taken care of?

No, the root pom needs to include  a <module> element for each
subdirectory.  Including the jars.

>I guess the main issue I'm
> having trouble wrapping my head around is if doing a package from the top
> level pom, how and when to jars get compiled/deployed and what do you need
> to do to achieve this?

List them all as modules.  (Assuming they are subdirectories.  The
hierarchy can actually be more complex with levels of parents, but for
now I'd get it working as a flatter structure with a single parent
that lists all of your modules.  Then refactor later if you find
duplication.)

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Adam Gibbons <ad...@gmail.com>.
Yes,

 +-- pom.xml
 +-- m1 (j1, j2)
 +-- m2 (j3)
 +-- m3 (j1, j3)
 +-- m4
 +-- m5
 +-- j1
 +-- j2
 +-- j3
 +-- war1 (m1,m2,m3)
 +-- war2 (m4)
 +-- war3 (m5)

This setup is effectively what I have so far.
However I am unable to use parent on a number of modules (as some have more
than 1). On reading the doco I don't believe this actually matters.
Am I right in thinking that the root pom only need include the war modules
and everything else should be taken care of? I guess the main issue I'm
having trouble wrapping my head around is if doing a package from the top
level pom, how and when to jars get compiled/deployed and what do you need
to do to achieve this?

Thanks for all the help so far!

Adam



On 6 April 2011 15:51, Karl Heinz Marbaise <ka...@soebes.de> wrote:

> Hi Adam,
>
>
> Adam Gibbons wrote:
> >
> > That is effectively what I have so far. Except there are also some jar
> > projects in the structure too which more than 1 module will reference.
> > (This
> > is to avoid sub-child modules being added to the reactor list more than
> > once.)
> So what's the problem this will result in this:
>
>  root
>  +-- pom.xml
>  +-- m1 (j1, j2)
>  +-- m2 (j3)
>  +-- m3 (j1, j3)
>  +-- m4
>  +-- m5
>  +-- j1
>  +-- j2
>  +-- j3
>   +-- war1 (m1,m2,m3)
>  +-- war2 (m4)
>  +-- war3 (m5)
>
> If you have correctly defined the dependency between the modules the build
> order will be done by Maven...to build this project you will go to the root
> and do mvn package and that should solv all things...
> So the point is does your current build work correctly? Have you defined
> the
> dependencies between the modules correctly? Do you have parent entry in
> m1..m5 etc...
>
>
> Adam Gibbons wrote:
> > At the moment I don't think the jar modules get compiled/deployed
> Do the modules beeing build by a single call from root ? have you tried mvn
> clean package ?
>
>
> Adam Gibbons wrote:
> > i'd really like to know how to achieve this!
> > Can I not use maven-assembly before building the war to solve the
> > jar/deployment issue and/or build 4 war files from 1 maven invocation?
> > Of course, but first you build must be working correctly...
>
> An example a single war creation you can find here:
> https://github.com/khmarbaise/supose/
> you can enhance this by adding supplemental war-modules with appropriate
> dependencies.
>
> Kind regards
> Karl Heinz Marbaise
>
> -----
> Kind regards
> Karl Heinz Marbaise
> ----
> http://www.soebes.de
> http://www.skmwiki.de
> http://supose.org/wiki/supose
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/The-maven-assembly-plugin-and-a-large-complex-project-tp4286366p4286443.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: The maven-assembly-plugin and a large complex project.

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi Adam,


Adam Gibbons wrote:
> 
> That is effectively what I have so far. Except there are also some jar
> projects in the structure too which more than 1 module will reference.
> (This
> is to avoid sub-child modules being added to the reactor list more than
> once.) 
So what's the problem this will result in this:

 root
  +-- pom.xml
  +-- m1 (j1, j2)
  +-- m2 (j3)
  +-- m3 (j1, j3)
  +-- m4
  +-- m5
  +-- j1
  +-- j2
  +-- j3
  +-- war1 (m1,m2,m3)
  +-- war2 (m4)
  +-- war3 (m5)

If you have correctly defined the dependency between the modules the build
order will be done by Maven...to build this project you will go to the root
and do mvn package and that should solv all things...
So the point is does your current build work correctly? Have you defined the
dependencies between the modules correctly? Do you have parent entry in
m1..m5 etc...


Adam Gibbons wrote:
> At the moment I don't think the jar modules get compiled/deployed
Do the modules beeing build by a single call from root ? have you tried mvn
clean package ?


Adam Gibbons wrote:
> i'd really like to know how to achieve this!
> Can I not use maven-assembly before building the war to solve the
> jar/deployment issue and/or build 4 war files from 1 maven invocation?
> Of course, but first you build must be working correctly...

An example a single war creation you can find here:
https://github.com/khmarbaise/supose/ 
you can enhance this by adding supplemental war-modules with appropriate
dependencies.

Kind regards
Karl Heinz Marbaise

-----
Kind regards
Karl Heinz Marbaise
----
http://www.soebes.de
http://www.skmwiki.de
http://supose.org/wiki/supose
--
View this message in context: http://maven.40175.n5.nabble.com/The-maven-assembly-plugin-and-a-large-complex-project-tp4286366p4286443.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 6, 2011 at 11:07 AM, Wendy Smoak <ws...@gmail.com> wrote:
> That's out of scope for Maven command line if you are *just* building
> the war from its subdirectory.  As I mentioned, it's something your
> IDE might handle for you.

Hmm, well... maybe not.  The output of "mvn --help" includes:

 -amd,--also-make-dependents            If project list is specified, also
                                        build projects that depend on
                                        projects on the list

However, I can't find much documentation on it.

It's mentioned here...
http://maven.apache.org/guides/mini/guide-multiple-modules.html
... which refers to a "Maven command line interface reference" which
doesn't seem to exist.

You might want to start a separate thread to ask about that feature
and see if it might be what you need.

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 6, 2011 at 10:56 AM, Adam Gibbons <ad...@gmail.com> wrote:

> for example let's say i build my pdf-creation.war file. this depends on a
> tree-like structure of sub modules and some in-house jar files. It seems
> that when I build the war the sub module tree is pulled in and the in-house
> dependencies/jars, but i think the jars are coming from the local repo.

Correct.  Maven will first look in your local repo then in remote
ones.  Unless it's looking for snapshot updates,which by default it
does once a day.

Are you using version numbers that end in -SNAPSHOT?  (You should be.)

> what
> i would like to happen is that it sees there are new compilation changes in
> the jar modules, it compiles and deploys those and then will go on to pull
> in the rest of the sub modules to build the war.

That's out of scope for Maven command line if you are *just* building
the war from its subdirectory.  As I mentioned, it's something your
IDE might handle for you.

> or have i got that wrong and it is actually doing as i though? is there an
> easy way to call the deploy plugin every time you do a package?

If you want it to deploy, use "mvn deploy" instead of (I assume) "mvn
package".  That will also put it in your local repo since install is
just before deploy in the lifecycle.

Note that you still haven't told us exactly what you're doing and what
output you're getting vs. what you expect, so we're still guessing. :)

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Adam Gibbons <ad...@gmail.com>.
Hi Wendy,

Thank you for the helpful reply! I've never used Maven on this scale before
and it's a steep learning curve! I've been trying to convert a massive multi
module project from ant to maven these past two weeks, it all compiles and
runs unit tests now, but i've had no end of problems getting the war files
to build correctly and i'm a bit worried i'm doing some of it wrong.

for example let's say i build my pdf-creation.war file. this depends on a
tree-like structure of sub modules and some in-house jar files. It seems
that when I build the war the sub module tree is pulled in and the in-house
dependencies/jars, but i think the jars are coming from the local repo. what
i would like to happen is that it sees there are new compilation changes in
the jar modules, it compiles and deploys those and then will go on to pull
in the rest of the sub modules to build the war.
or have i got that wrong and it is actually doing as i though? is there an
easy way to call the deploy plugin every time you do a package?

Cheers,
Adam


On 6 April 2011 15:44, Wendy Smoak <ws...@gmail.com> wrote:

> On Wed, Apr 6, 2011 at 10:37 AM, Adam Gibbons <ad...@gmail.com>
> wrote:
>
> > At the moment I don't think the jar modules get compiled/deployed
> > when i build the war.
>
> What makes you say that?  What exactly are you doing and what happens
> vs. what you expected to happen?
>
> Guessing, I'd say you are in one of the war subdirectories typing "mvn
> install".
>
> In that case, no, the Maven command line is not going to go build
> anything else.   (If you need that to happen, I think some IDEs can
> handle it for you.)
>
> Instead, move up a level to the top-level pom shown in Karl's example
> structure, and build from there.
>
> Maven will then figure out the correct order and build everything for you.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 6, 2011 at 10:37 AM, Adam Gibbons <ad...@gmail.com> wrote:

> At the moment I don't think the jar modules get compiled/deployed
> when i build the war.

What makes you say that?  What exactly are you doing and what happens
vs. what you expected to happen?

Guessing, I'd say you are in one of the war subdirectories typing "mvn install".

In that case, no, the Maven command line is not going to go build
anything else.   (If you need that to happen, I think some IDEs can
handle it for you.)

Instead, move up a level to the top-level pom shown in Karl's example
structure, and build from there.

Maven will then figure out the correct order and build everything for you.

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Adam Gibbons <ad...@gmail.com>.
Hi Karl,

That is effectively what I have so far. Except there are also some jar
projects in the structure too which more than 1 module will reference. (This
is to avoid sub-child modules being added to the reactor list more than
once.) At the moment I don't think the jar modules get compiled/deployed
when i build the war. i'd really like to know how to achieve this!
Can I not use maven-assembly before building the war to solve the
jar/deployment issue and/or build 4 war files from 1 maven invocation?

Again, any real world working examples of this sort of project would be
greatly appreciated!

Regards,
Adam

On 6 April 2011 15:27, Karl Heinz Marbaise <kh...@gmx.de> wrote:

> Hi Adam,
>
> > What I would like is a top level pom which upon doing mvn package it will
> > produce my 4 WAR files by compiling all child modules AND jars.
> > Each WAR file is comprised of a number of modules and some of the
> multiple
> > modules have a dependency on in-house compiled jars. Ideally when
> building
> > the WARs I'd like all of the child modules and jars built/deployed.
>
> That sound's you're trying a wrong thing, cause a war should be produced by
> the Maven War Plugin and not via maven-assembly-plugin...
> I would suggest to use a structure like this:
>
> root
>  +-- pom.xml
>  +-- m1
>  +-- m2
>  +-- m3
>  +-- m4
>  +-- m5
>  +-- war1 (m1,m2,m3)
>  +-- war2 (m4)
>  +-- war3 (m5)
>
> Kind regards
> Karl Heinz Marbaise
> --
> MfG
> Karl Heinz Marbaise
> --
> SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
> Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
> Hauptstrasse 177                     USt.IdNr: DE191347579
> 52146 Würselen                           http://www.soebes.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: The maven-assembly-plugin and a large complex project.

Posted by Alex Lopez <al...@flordeutopia.pt>.
BTW the "mvn install" or "mvn deploy" is done in our case on the top 
directory, the reactor one, and it gets propagated to the others in 
appropriate order by the reactor module.

Em 07-04-2011 11:16, Alex Lopez escreveu:
> I don't think I can post the full thing, but I'll post some cut down
> version so you can make an idea.
>
> BTW, I got the idea from the documentation on sonatype site, look into
> maven reference and maven by example books, available for free. They
> include links to sample projects configured more or less this way.
>
> http://www.sonatype.com/books/mvnref-book/reference/public-book.html
>
> Em 07-04-2011 10:30, Adam Gibbons escreveu:
>> Alex, that's perfect! Exactly the kind of thing I'm trying to do myself.
>> Would you mind posting your reactor, war, jar and parent poms please? I'd
>> really like to see a working example of this in action.
>>
>> Cheers,
>> Adam
>>
>> On 7 April 2011 09:51, Alex Lopez<al...@flordeutopia.pt> wrote:
>>
>>> Here we have a similar setup, we manage to build everything into a WAR
>>> including dependent jars using reactor/assembly project:
>>>
>>> BTW, we use separate poms for parent (inheritance) and reactor
>>> (multi-module), which I think makes sense as all sub-modules have the
>>> parent
>>> as parent but not one sub-module even knows about the reactor one (which
>>> serves just to build everything).
>>>
>>> So the reactor project lists ALL other modules (besides parent, only
>>> used
>>> to inherit properties). Not a module depends or inherits from reactor
>>> module. The war module depends on some jars, which in turn depend on
>>> other
>>> jars etc.
>>>
>>> So when we issue "mvn install" or "mvn deploy" in the reactor
>>> project, it
>>> will first see the dependency graph going from the war to everything
>>> else,
>>> and first install/deploy the needed things (jars) so, when it reaches
>>> the
>>> war for packaging, all the necesary jars have already been
>>> installed/deployed, and are available as dependencies to the war,
>>> which gets
>>> packaged and installed/deployed as expected.
>>>
>>> So I thing the tricky part for us to see about reactor and parent and
>>> modules and all this stuff was separating concerns: our parent only
>>> used to
>>> inherit, the reactor only used to lists all other modules, and the build
>>> order is determined by a correctly specified dependency graph (the war
>>> depends on jars, etc).
>>>
>>> With multiple wars I believe it should behave the same way, if
>>> dependencies
>>> spring from the wars to the jars they depend on (and thus when building
>>> separate graphs are calculated each culminating in a war with other
>>> dependencies included inside as jars).
>>>
>>> Em 06-04-2011 15:46, Wendy Smoak escreveu:
>>>
>>> On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons<ad...@gmail.com>
>>>> wrote:
>>>>
>>>>> Also I refer you to:
>>>>> http://maven.apache.org/plugins/maven-assembly-plugin/which states
>>>>> that it can create distributions in the war format.
>>>>>
>>>>
>>>> It *can* but you generally only need it if the war plugin is not doing
>>>> what you need.
>>>>
>>>> When building a war, the war plugin is the logical choice _until_ you
>>>> run into some complication that the war plugin can't solve.
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> 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
>

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Alex Lopez <al...@flordeutopia.pt>.
This is an example multi-module project with separate war, reactor and 
parent poms

Em 07-04-2011 11:16, Alex Lopez escreveu:
> I don't think I can post the full thing, but I'll post some cut down
> version so you can make an idea.
>
> BTW, I got the idea from the documentation on sonatype site, look into
> maven reference and maven by example books, available for free. They
> include links to sample projects configured more or less this way.
>
> http://www.sonatype.com/books/mvnref-book/reference/public-book.html
>
> Em 07-04-2011 10:30, Adam Gibbons escreveu:
>> Alex, that's perfect! Exactly the kind of thing I'm trying to do myself.
>> Would you mind posting your reactor, war, jar and parent poms please? I'd
>> really like to see a working example of this in action.
>>
>> Cheers,
>> Adam
>>
>> On 7 April 2011 09:51, Alex Lopez<al...@flordeutopia.pt> wrote:
>>
>>> Here we have a similar setup, we manage to build everything into a WAR
>>> including dependent jars using reactor/assembly project:
>>>
>>> BTW, we use separate poms for parent (inheritance) and reactor
>>> (multi-module), which I think makes sense as all sub-modules have the
>>> parent
>>> as parent but not one sub-module even knows about the reactor one (which
>>> serves just to build everything).
>>>
>>> So the reactor project lists ALL other modules (besides parent, only
>>> used
>>> to inherit properties). Not a module depends or inherits from reactor
>>> module. The war module depends on some jars, which in turn depend on
>>> other
>>> jars etc.
>>>
>>> So when we issue "mvn install" or "mvn deploy" in the reactor
>>> project, it
>>> will first see the dependency graph going from the war to everything
>>> else,
>>> and first install/deploy the needed things (jars) so, when it reaches
>>> the
>>> war for packaging, all the necesary jars have already been
>>> installed/deployed, and are available as dependencies to the war,
>>> which gets
>>> packaged and installed/deployed as expected.
>>>
>>> So I thing the tricky part for us to see about reactor and parent and
>>> modules and all this stuff was separating concerns: our parent only
>>> used to
>>> inherit, the reactor only used to lists all other modules, and the build
>>> order is determined by a correctly specified dependency graph (the war
>>> depends on jars, etc).
>>>
>>> With multiple wars I believe it should behave the same way, if
>>> dependencies
>>> spring from the wars to the jars they depend on (and thus when building
>>> separate graphs are calculated each culminating in a war with other
>>> dependencies included inside as jars).
>>>
>>> Em 06-04-2011 15:46, Wendy Smoak escreveu:
>>>
>>> On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons<ad...@gmail.com>
>>>> wrote:
>>>>
>>>>> Also I refer you to:
>>>>> http://maven.apache.org/plugins/maven-assembly-plugin/which states
>>>>> that it can create distributions in the war format.
>>>>>
>>>>
>>>> It *can* but you generally only need it if the war plugin is not doing
>>>> what you need.
>>>>
>>>> When building a war, the war plugin is the logical choice _until_ you
>>>> run into some complication that the war plugin can't solve.
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> 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
>


Re: The maven-assembly-plugin and a large complex project.

Posted by Alex Lopez <al...@flordeutopia.pt>.
I don't think I can post the full thing, but I'll post some cut down 
version so you can make an idea.

BTW, I got the idea from the documentation on sonatype site, look into 
maven reference and maven by example books, available for free. They 
include links to sample projects configured more or less this way.

http://www.sonatype.com/books/mvnref-book/reference/public-book.html

Em 07-04-2011 10:30, Adam Gibbons escreveu:
> Alex, that's perfect! Exactly the kind of thing I'm trying to do myself.
> Would you mind posting your reactor, war, jar and parent poms please? I'd
> really like to see a working example of this in action.
>
> Cheers,
> Adam
>
> On 7 April 2011 09:51, Alex Lopez<al...@flordeutopia.pt>  wrote:
>
>> Here we have a similar setup, we manage to build everything into a WAR
>> including dependent jars using reactor/assembly project:
>>
>> BTW, we use separate poms for parent (inheritance) and reactor
>> (multi-module), which I think makes sense as all sub-modules have the parent
>> as parent but not one sub-module even knows about the reactor one (which
>> serves just to build everything).
>>
>> So the reactor project lists ALL other modules (besides parent, only used
>> to inherit properties). Not a module depends or inherits from reactor
>> module. The war module depends on some jars, which in turn depend on other
>> jars etc.
>>
>> So when we issue "mvn install" or "mvn deploy" in the reactor project, it
>> will first see the dependency graph going from the war to everything else,
>> and first install/deploy the needed things (jars) so, when it reaches the
>> war for packaging, all the necesary jars have already been
>> installed/deployed, and are available as dependencies to the war, which gets
>> packaged and installed/deployed as expected.
>>
>> So I thing the tricky part for us to see about reactor and parent and
>> modules and all this stuff was separating concerns: our parent only used to
>> inherit, the reactor only used to lists all other modules, and the build
>> order is determined by a correctly specified dependency graph (the war
>> depends on jars, etc).
>>
>> With multiple wars I believe it should behave the same way, if dependencies
>> spring from the wars to the jars they depend on (and thus when building
>> separate graphs are calculated each culminating in a war with other
>> dependencies included inside as jars).
>>
>> Em 06-04-2011 15:46, Wendy Smoak escreveu:
>>
>>   On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons<ad...@gmail.com>
>>>   wrote:
>>>
>>>> Also I refer you to:
>>>> http://maven.apache.org/plugins/maven-assembly-plugin/which states
>>>> that it can create distributions in the war format.
>>>>
>>>
>>> It *can* but you generally only need it if the war plugin is not doing
>>> what you need.
>>>
>>> When building a war, the war plugin is the logical choice _until_ you
>>> run into some complication that the war plugin can't solve.
>>>
>>>
>> ---------------------------------------------------------------------
>> 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


Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Thu, Apr 7, 2011 at 5:30 AM, Adam Gibbons <ad...@gmail.com> wrote:
> Alex, that's perfect! Exactly the kind of thing I'm trying to do myself.
> Would you mind posting your reactor, war, jar and parent poms please? I'd
> really like to see a working example of this in action.

There are lots of open source projects out there where you can see the
whole thing.

Have a look at the Apache Archiva (repository manager) build:
http://svn.apache.org/repos/asf/archiva/trunk/

The hierarchy is much deeper here, but if you start at
   http://svn.apache.org/repos/asf/archiva/trunk/archiva-modules/archiva-base/
you will see the pom.xml in that directory has <type>pom</type> and a
list of <modules> that match the subdirectories.

If you list *all* the subdirectories as <modules> Maven will figure
out the build order based on how they depend on each other.

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Adam Gibbons <ad...@gmail.com>.
Alex, that's perfect! Exactly the kind of thing I'm trying to do myself.
Would you mind posting your reactor, war, jar and parent poms please? I'd
really like to see a working example of this in action.

Cheers,
Adam

On 7 April 2011 09:51, Alex Lopez <al...@flordeutopia.pt> wrote:

> Here we have a similar setup, we manage to build everything into a WAR
> including dependent jars using reactor/assembly project:
>
> BTW, we use separate poms for parent (inheritance) and reactor
> (multi-module), which I think makes sense as all sub-modules have the parent
> as parent but not one sub-module even knows about the reactor one (which
> serves just to build everything).
>
> So the reactor project lists ALL other modules (besides parent, only used
> to inherit properties). Not a module depends or inherits from reactor
> module. The war module depends on some jars, which in turn depend on other
> jars etc.
>
> So when we issue "mvn install" or "mvn deploy" in the reactor project, it
> will first see the dependency graph going from the war to everything else,
> and first install/deploy the needed things (jars) so, when it reaches the
> war for packaging, all the necesary jars have already been
> installed/deployed, and are available as dependencies to the war, which gets
> packaged and installed/deployed as expected.
>
> So I thing the tricky part for us to see about reactor and parent and
> modules and all this stuff was separating concerns: our parent only used to
> inherit, the reactor only used to lists all other modules, and the build
> order is determined by a correctly specified dependency graph (the war
> depends on jars, etc).
>
> With multiple wars I believe it should behave the same way, if dependencies
> spring from the wars to the jars they depend on (and thus when building
> separate graphs are calculated each culminating in a war with other
> dependencies included inside as jars).
>
> Em 06-04-2011 15:46, Wendy Smoak escreveu:
>
>  On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons<ad...@gmail.com>
>>  wrote:
>>
>>> Also I refer you to:
>>> http://maven.apache.org/plugins/maven-assembly-plugin/which states
>>> that it can create distributions in the war format.
>>>
>>
>> It *can* but you generally only need it if the war plugin is not doing
>> what you need.
>>
>> When building a war, the war plugin is the logical choice _until_ you
>> run into some complication that the war plugin can't solve.
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: The maven-assembly-plugin and a large complex project.

Posted by Alex Lopez <al...@flordeutopia.pt>.
Here we have a similar setup, we manage to build everything into a WAR 
including dependent jars using reactor/assembly project:

BTW, we use separate poms for parent (inheritance) and reactor 
(multi-module), which I think makes sense as all sub-modules have the 
parent as parent but not one sub-module even knows about the reactor one 
(which serves just to build everything).

So the reactor project lists ALL other modules (besides parent, only 
used to inherit properties). Not a module depends or inherits from 
reactor module. The war module depends on some jars, which in turn 
depend on other jars etc.

So when we issue "mvn install" or "mvn deploy" in the reactor project, 
it will first see the dependency graph going from the war to everything 
else, and first install/deploy the needed things (jars) so, when it 
reaches the war for packaging, all the necesary jars have already been 
installed/deployed, and are available as dependencies to the war, which 
gets packaged and installed/deployed as expected.

So I thing the tricky part for us to see about reactor and parent and 
modules and all this stuff was separating concerns: our parent only used 
to inherit, the reactor only used to lists all other modules, and the 
build order is determined by a correctly specified dependency graph (the 
war depends on jars, etc).

With multiple wars I believe it should behave the same way, if 
dependencies spring from the wars to the jars they depend on (and thus 
when building separate graphs are calculated each culminating in a war 
with other dependencies included inside as jars).

Em 06-04-2011 15:46, Wendy Smoak escreveu:
> On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons<ad...@gmail.com>  wrote:
>> Also I refer you to:
>> http://maven.apache.org/plugins/maven-assembly-plugin/which states
>> that it can create distributions in the war format.
>
> It *can* but you generally only need it if the war plugin is not doing
> what you need.
>
> When building a war, the war plugin is the logical choice _until_ you
> run into some complication that the war plugin can't solve.
>

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 6, 2011 at 10:44 AM, Adam Gibbons <ad...@gmail.com> wrote:
> Also I refer you to:
> http://maven.apache.org/plugins/maven-assembly-plugin/which states
> that it can create distributions in the war format.

It *can* but you generally only need it if the war plugin is not doing
what you need.

When building a war, the war plugin is the logical choice _until_ you
run into some complication that the war plugin can't solve.

-- 
Wendy

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


Re: The maven-assembly-plugin and a large complex project.

Posted by Adam Gibbons <ad...@gmail.com>.
Also I refer you to:
http://maven.apache.org/plugins/maven-assembly-plugin/which states
that it can create distributions in the war format.

On 6 April 2011 15:27, Karl Heinz Marbaise <kh...@gmx.de> wrote:

> Hi Adam,
>
> > What I would like is a top level pom which upon doing mvn package it will
> > produce my 4 WAR files by compiling all child modules AND jars.
> > Each WAR file is comprised of a number of modules and some of the
> multiple
> > modules have a dependency on in-house compiled jars. Ideally when
> building
> > the WARs I'd like all of the child modules and jars built/deployed.
>
> That sound's you're trying a wrong thing, cause a war should be produced by
> the Maven War Plugin and not via maven-assembly-plugin...
> I would suggest to use a structure like this:
>
> root
>  +-- pom.xml
>  +-- m1
>  +-- m2
>  +-- m3
>  +-- m4
>  +-- m5
>  +-- war1 (m1,m2,m3)
>  +-- war2 (m4)
>  +-- war3 (m5)
>
> Kind regards
> Karl Heinz Marbaise
> --
> MfG
> Karl Heinz Marbaise
> --
> SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
> Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
> Hauptstrasse 177                     USt.IdNr: DE191347579
> 52146 Würselen                           http://www.soebes.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: The maven-assembly-plugin and a large complex project.

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi Adam,

> What I would like is a top level pom which upon doing mvn package it will
> produce my 4 WAR files by compiling all child modules AND jars.
> Each WAR file is comprised of a number of modules and some of the multiple
> modules have a dependency on in-house compiled jars. Ideally when building
> the WARs I'd like all of the child modules and jars built/deployed.

That sound's you're trying a wrong thing, cause a war should be produced by the Maven War Plugin and not via maven-assembly-plugin...
I would suggest to use a structure like this:

root
  +-- pom.xml
  +-- m1
  +-- m2
  +-- m3
  +-- m4
  +-- m5
  +-- war1 (m1,m2,m3)
  +-- war2 (m4)
  +-- war3 (m5)

Kind regards
Karl Heinz Marbaise
-- 
MfG
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                     USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de


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