Hi Tony,

Tony Lâmpada wrote:

> We all know maven has a lot of available
> plugins<http://maven.apache.org/plugins/index.html>that do a lot of
> useful stuff.
> 
> I recently learned about a different kind of extension point for maven
> builds: build
> extensions<http://maven.apache.org/examples/maven-3-lifecycle-
extensions.html>
> .
> 
> Is there a similar list of useful build extensions that one can use?
> And more specifically, one that can maybe help with
> this<http://stackoverflow.com/questions/11749375/import-maven-plugin-
configuration-by-composition-rather-than-inheritance-can-it>
> ?

Well, with M3 you can use profiles ... hehehe

Seriously, I'd not meddle with the execution order at runtime. You will not 
have much fun with a parallel build later.

First you have to understand, why your profile example cannot work (and 
never will). Maven *has to* resolve the parent POM completely first (i.e. 
all profiles are evaluated and merged into the effective POM). Then the same 
happens for the current POM. Obviously no property will have now any effect 
on profile activation in the parent ... this is simply too late.

You must also know, that the output of help:active-profiles is not complete. 
It does not show you the profiles that have been activated in a parent POM.

The best you can do in your use case is to define a profile in the parent 
and activate it based on the existence on a file. We have a profile in our 
global POM that automatically activates the verifier plugin, if the project 
contains a verifications file:

======== %< ========
  <profile>
    <id>auto-verification</id>
    <activation>
      <file>
        <!-- cannot use variables here -->
        <exists>src/test/verifier/verifications.xml</exists>
      </file>
    </activation>
    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-verifier-plugin</artifactId>
        </plugin>
      </plugins>
    </build>
  </profile>
======== %< ========

However, this will only work in a multi-project build with M3, but not with 
M2, because M3 uses the current POM root as reference for file resolution, 
while M2 uses the current working directory.

For your problem you might simply create in your projects a profile folder 
that contains empty files with proper names

======== %< ========
/
+ boy
  + profiles
    - kid
    - boy
+ girl
  + profiles
    - kid
    - girl
+ kid
  + profiles
    - kid
======== %< ========

and the profile activation is based on existence of those files, e.g.
  <exists>profile/kid</exists>

Hope this helps,
Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to