On 27 April 2012 13:29, Jesse Glick <[email protected]> wrote:
> On 04/27/2012 01:39 PM, Hilco Wijbenga wrote:
>>
>> What about -am and -amd?
>
> -am does work together with -pl. Vincent's issue is that -pl must be given a
> full list of submodules; just passing an aggregator is not enough. For
> example, take
>
> top
> +- libs
> |  +- lib1
> |  +- lib2
> +- apps
>   +- app1
>   |  +- mod1 > [lib1]
>   |  +- mod2 > []
>   +- app2
>      +- mod1 > []
>      +- mod2 > [lib2]
>
> where top, libs, apps, app1, and app2 are aggregator projects. Now say you
> want to build the first application. What should you do?
>
> 1. 'cd apps/app1 && mvn' will not work unless lib1 has been previously
> built; -am does not help.
>
> 2. 'mvn -pl apps/app1 -am' will just install app1-$version.pom; it does not
> recurse into mod1 & mod2. (*)
>
> 3. 'mvn -pl apps/app1,apps/app1/mod1,apps/app1/mod2 -am' works (builds also
> lib1) but requires you on the command line to determine what the submodules
> of apps/app1 are.

Great, thanks! That makes it a lot clearer.

> My own MNG-5059 [1] is a little related: the Maven CLI offers only limited
> options for building a set of modules. Perhaps there should be a DSL for
> selecting subsets of a reactor tree in various ways and building the subsets
> thus calculated to particular phases, all within a single CLI invocation.
> The old reactor:make could be revamped to do this, I guess, leaving M3's
> built-in options just for the simplest cases.

I guess this could be part of Maven Shell?

Actually, I've been working on a Maven extension that uses checksums
to determine whether a particular project needs to be rebuilt (taking
all its dependencies into account). We are currently using a Bash
script for that purpose. It simply invokes Maven for each project that
needs to be (re)built but, obviously, doing this from Maven directly
is much easier, faster, and more reliable.

> (*) As Jason points out, existing systems may rely on an aggregator project
> passed to -pl being interpreted without recursion. In particular, NetBeans
> IDE "priming builds" rely on this behavior.
>
> [1] http://jira.codehaus.org/browse/MNG-5059
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to