maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Lampada (JIRA)" <j...@codehaus.org>
Subject [jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom
Date Wed, 01 Aug 2012 13:52:21 GMT

    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=305161#comment-305161
] 

Tony Lampada commented on MNG-5127:
-----------------------------------

Jörge Schaible found me an even better solution.
Please see http://www.mail-archive.com/dev@maven.apache.org/msg92863.html

That means the this issue's summary is not completely true.

*File-based profile activation is actually inherited!*

I'm attaching [daddy2.zip](http://jira.codehaus.org/secure/attachment/60790/daddy2.zip) as
evidence of that.

IMO it would be a good thing if this kind of setup was better documented.
Maybe add a "daddy2-like" example here --> http://maven.apache.org/guides/introduction/introduction-to-profiles.html
It seems I'm not the only one looking for this kind of flexibility (http://stackoverflow.com/questions/10245621/how-to-inherit-from-a-multimodule-maven-project-with-all-its-goodies)

My big thanks to Jörge Schaible!
                
> CLONE - Maven profile activation does not work when profile is defined in inherited 'parent'
pom
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-5127
>                 URL: https://jira.codehaus.org/browse/MNG-5127
>             Project: Maven 2 & 3
>          Issue Type: Bug
>            Reporter: Gilles Scokart
>            Assignee: John Casey
>         Attachments: daddy2.zip, daddy.zip
>
>
> The goal is to activate a maven profile based on OS user name.
> When I create a standalone project with a profile activation, it works,
> however, when I define the profile in a "parent" pom, it is never activated.
> this works:
> ...
>   <profile>
>     <id>TONY</id>
> <activation>
> <property>
> <name>user.name</name>
> <value>WINTONY</value>
> </property>
> </activation>
>     <properties>
>     </properties>
>    
> So in this case, my profile is activated based on my OS user name
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'help'.
> [INFO] ----------------------------------------------------------------------------
> [INFO] Building Proj1
> [INFO] task-segment: [help:active-profiles] (aggregator-style)
> [INFO] ----------------------------------------------------------------------------
> [INFO] [help:active-profiles]
> [INFO]
> Active Profiles for Project 'com.capgemini.be.proj1:parent:pom:4.0.2':
> The following profiles are active:
>  - TONY (source: pom)
> ------------------
> However, if I now have the profiles definition in the "parent" pom, it doesn't work when
I build a child project
> So the child project references the parent pom containing the profiles and the activation,
but when it is built,
> the profile is not activated
> PARENT POM:
> ...
>   <profiles>
>   <profile>
>     <id>TONY</id>
> <activation>
> <property>
> <name>user.name</name>
> <value>WINTONY</value>
> </property>
> </activation>
>     <properties>
> ...
> CHILD POM (the one being built)
> <project>
> <parent>
> <groupId>com.capgemini.be.proj1</groupId>
> <artifactId>parent</artifactId>
> <version>4.0.2</version>
> </parent>
> [INFO] Scanning for projects...
> [INFO] Searching repository for plugin with prefix: 'help'.
> [INFO] ----------------------------------------------------------------------------
> [INFO] Building Proj1 Application
> [INFO] task-segment: [help:active-profiles] (aggregator-style)
> [INFO] ----------------------------------------------------------------------------
> [INFO] [help:active-profiles]
> [INFO]
> Active Profiles for Project 'com.capgemini.be.proj1:proj1-webapp:jar:4.0.2':
> There are no active profiles. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message