You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by spoots <sp...@gmail.com> on 2013/04/12 06:45:01 UTC

Building selected projects with nested aggregators

Hi,

I've got a project structure where I have an aggregator project and all of
it's modules are also aggregator projects (i.e. projects that exist just to
specify sub-modules). Picture something like what's shown in the "POM best
practices" section of the Maven reference:
<http://maven.40175.n5.nabble.com/file/n5753572/pom_real_multi.png> 

Now pretend that project "streaming-client" has a dependency on project
"client-web". If I do a build of "big-system", Maven will put "client-web"
ahead of "streaming-client" in the reactor order which is dandy - it seems
to walk the whole project tree and resolve the dependencies just fine.

But how can I specify, from the top level, to build "client-web" and all
it's dependents if I change just that one project? Using the "-pl" option
from within "big-system" seems to only recognise project names that are
directly included in that reactor (e.g. "server-side" and "client-side"). Is
there some kind of qualifier that lets me specify a project which is nested
within another aggregator project?

Thanks,
Keith



--
View this message in context: http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572.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: Building selected projects with nested aggregators

Posted by Nick Stolwijk <ni...@gmail.com>.
Hello all,

We also want to build a --project-list with a aggregator pom, so all the
modules of  that pom are getting build. In the mean time, we also want the
dependencies of those module to  build. (So, --also-make). Only we can't
get this to run. Is there anyone who can help with this?

We were thinking of a Bash or Groovy script to parse the aggregator pom to
build up the --project-list argument.

Does anyone see an easier way?

With regards,

Nick Stolwijk

~~~ Try to leave this world a little better than you found it and, when
your turn comes to die, you can die happy in feeling that at any rate you
have not wasted your time but have done your best ~~~

Lord Baden-Powell

On Tue, May 7, 2013 at 2:39 AM, spoots <sp...@gmail.com> wrote:

> Thanks for the reply, again :)
>
> I don't think "-amd" covers my need though. Because there's no parent/child
> relationship between the modules/sub-modules there's no dependency between
> them. It feels to me like there's an option missing for the reactor here...
>
> A simpler example for clarity:
>
> &lt;a&gt;
>   &lt;b&gt;
>     &lt;c /&gt;
>     &lt;d /&gt;
>     &lt;e /&gt;
>   &lt;/b&gt;
>   &lt;f /&gt;
>   &lt;g /&gt;
> &lt;/a&gt;
>
> Each node is a project, and sub-projects are nested. For dependencies, say
> only that "c depends on f". There are no parent-child relationships.
>
> If I want to build &lt;b&gt; with all its sub-modules (&lt;c&gt; &lt;d&gt;
> &lt;e&gt;) and dependencies (&lt;f&gt;), can I do that? The only options I
> see are:
> 1 - change to b directory, then "mvn install"
> 2 - from top level, "mvn install -pl a/b -amd"
> 3 - from top level, "mvn install -pl a/b/c,a/b/d,a/b/e -amd"
>
> Option 1 builds the sub-modules I want, but doesn't build the dependency
> &lt;f&gt;.
> Option 2 only builds the project &lt;b&gt;, none of it's sub-modules
> because
> they are not dependents.
> Option 3 works, but it's no good because I need to know & provide all the
> sub-modules of &lt;b&gt;.
>
> Ideally there'd be an option like "-ams" (also make sub-modules) which I
> could use in option 2, but I can't see any way to do it?
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5755076.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: Building selected projects with nested aggregators

Posted by spoots <sp...@gmail.com>.
Thanks for the reply, again :)

I don't think "-amd" covers my need though. Because there's no parent/child
relationship between the modules/sub-modules there's no dependency between
them. It feels to me like there's an option missing for the reactor here...

A simpler example for clarity:

&lt;a&gt;
  &lt;b&gt;
    &lt;c /&gt;
    &lt;d /&gt;
    &lt;e /&gt;
  &lt;/b&gt;
  &lt;f /&gt;
  &lt;g /&gt;
&lt;/a&gt;

Each node is a project, and sub-projects are nested. For dependencies, say
only that "c depends on f". There are no parent-child relationships.

If I want to build &lt;b&gt; with all its sub-modules (&lt;c&gt; &lt;d&gt;
&lt;e&gt;) and dependencies (&lt;f&gt;), can I do that? The only options I
see are:
1 - change to b directory, then "mvn install"
2 - from top level, "mvn install -pl a/b -amd"
3 - from top level, "mvn install -pl a/b/c,a/b/d,a/b/e -amd"

Option 1 builds the sub-modules I want, but doesn't build the dependency
&lt;f&gt;.
Option 2 only builds the project &lt;b&gt;, none of it's sub-modules because
they are not dependents. 
Option 3 works, but it's no good because I need to know & provide all the
sub-modules of &lt;b&gt;.

Ideally there'd be an option like "-ams" (also make sub-modules) which I
could use in option 2, but I can't see any way to do it?



--
View this message in context: http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5755076.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: Building selected projects with nested aggregators

Posted by Andreas Gudian <an...@gmail.com>.
Hi,

You may actually want to check out the difference between -am ("also make
dependencies") and -amd ("also make dependents"). In conjunction with -pl
called from your topmost aggregator directory, you should pretty much get
what you need. I guess. ;-)


Am Freitag, 3. Mai 2013 schrieb spoots :

> Oops, just realised this scenario doesn't quite reflect my situation.
>
> Please also imagine in the attached image that there is no parent/child
> relationship between "webapps" and it's sub-modules, i.e. it's purely an
> aggregator POM
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5754823.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>

Re: Building selected projects with nested aggregators

Posted by spoots <sp...@gmail.com>.
Oops, just realised this scenario doesn't quite reflect my situation. 

Please also imagine in the attached image that there is no parent/child
relationship between "webapps" and it's sub-modules, i.e. it's purely an
aggregator POM



--
View this message in context: http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5754823.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: Building selected projects with nested aggregators

Posted by spoots <sp...@gmail.com>.
Sorry to bump my own thread, but I've got a another use-case and I'm hoping
there's a similarly blindingly obvious solution :)

What if I want to build all the sub-modules of, say, "web-apps" and their
dependencies across the whole tree? I know I can go in to the "web-apps"
aggregator and do a "mvn install", but then this won't build any of the
dependencies from sibling/parent aggregators.

Any way to do this without having to call out all the sub-modules
explicitly?



--
View this message in context: http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5754822.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: Building selected projects with nested aggregators

Posted by spoots <sp...@gmail.com>.
Bingo!

I can't believe I never tried that, but it works perfectly. Thank you :)



--
View this message in context: http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572p5753574.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: Building selected projects with nested aggregators

Posted by Andreas Gudian <an...@gmail.com>.
Hi,

just use the directory notation. The following will build the module
in module-dir/sub-module-dir
and all the modules in the reactor that depend on it:

mvn test -pl module-dir/sub-module-dir -amd

Andreas

Am Freitag, 12. April 2013 schrieb spoots :

> Hi,
>
> I've got a project structure where I have an aggregator project and all of
> it's modules are also aggregator projects (i.e. projects that exist just to
> specify sub-modules). Picture something like what's shown in the "POM best
> practices" section of the Maven reference:
> <http://maven.40175.n5.nabble.com/file/n5753572/pom_real_multi.png>
>
> Now pretend that project "streaming-client" has a dependency on project
> "client-web". If I do a build of "big-system", Maven will put "client-web"
> ahead of "streaming-client" in the reactor order which is dandy - it seems
> to walk the whole project tree and resolve the dependencies just fine.
>
> But how can I specify, from the top level, to build "client-web" and all
> it's dependents if I change just that one project? Using the "-pl" option
> from within "big-system" seems to only recognise project names that are
> directly included in that reactor (e.g. "server-side" and "client-side").
> Is
> there some kind of qualifier that lets me specify a project which is nested
> within another aggregator project?
>
> Thanks,
> Keith
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Building-selected-projects-with-nested-aggregators-tp5753572.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org <javascript:;>
> For additional commands, e-mail: users-help@maven.apache.org<javascript:;>
>
>