maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barrie Treloar <baerr...@gmail.com>
Subject Re: multi-module lifecycle question
Date Thu, 07 Mar 2013 00:12:54 GMT
On 7 March 2013 10:31, Warner Onstine <warnero@gmail.com> wrote:
> Hi all, been working with a multi-module build that has the following
> characteristics:
> - All sub-modules have the parent pom as their parent
> - I have Integration tests setup as their own module
> - parent pom has profiles for specific environments setup
>
> In the parent pom I have the a plugin bound to the prepare-package phase
> and inherit marked to false (I only want the plugin to run once at the end
> of the build, or once before another phase starts). The behavior I am
> seeing though is this:
> - Run mvn package -D profileName
> - it executes my plugin at the top-level first
> - Then it proceeds to compile and run the tests on each of the sub-modules
> - It never runs my plugin again
>
> What I expected to happen:
> - Compile each sub-module
> - Run the tests on each sub-module
> - See the prepare-package at the root level (because it now hit that phase)
> - Run package on each sub-module

The Maven reactor runs the complete lifecycle
(http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html)
in the order specified by the build plan.
In your case it would be Parent, Module 1, Module 2, ..., Module N

It does not run each step of the lifecycle against each module before
progressing to the next step in the lifecycle.
i.e it does not do:
* Compile
** Parent
** Module 1
** ...
** Module N
...
* Package
** Parent
** Module 1
...
** Module N

>
> I'm not clear as to why the build is doing all the phases within each
> module rather than phase-first then module.
>
> Is there an easy/clean way to do this?
>
> The solution I have come up with so far is either
> - turn inherit to true and it will run my plugin for each module (bad)
> - Move my specific phase stuff into each module that may need it for each
> profile (pain in the ass)
>
> Other ideas?

Without knowing what your plugin does, and why you are attempting to
do it this way, it is difficult to provide any more concrete advice.

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


Mime
View raw message