You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Gilles Scokart (JIRA)" <ji...@codehaus.org> on 2011/07/06 21:56:43 UTC

[jira] Created: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

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


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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Gilles Scokart (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272561#comment-272561 ] 

Gilles Scokart commented on MNG-5127:
-------------------------------------

Actually, it is.

In my [grand]-parent pom, I have a profile always active.  When I run in my sub-prjoect mvn help:all-profiles, I see the profile as being inactive.  But if I run the build, the plugin of my profile are being executed.

However, if I specify an other profile with -P on the comand line, the 'always' active profile is not active anymore.

I'm not sure anymore what is feature and what is not.  I think there is at least an issue in the help plugin.  If the plugin defined in the profile will be executed, I think they should be listed as active.

The other (maybe as designed) issue is that providing a profile with -P disable the profile supposed to be always active.

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Dominik Bartholdi (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=291987#comment-291987 ] 

Dominik Bartholdi commented on MNG-5127:
----------------------------------------

Is there a final statement on this?
If think it clear that some kind of inheritance is needed for profiles - for me, at least the activation of a profile must be inherited to the childs.
Having only the '-PmyProfile1,myProfile2' switch is not acceptable if one needs to have multiple combinations of profiles.

What do you think about adding a new commandline option to allow this? e.g.:

$> mvn -inheritProfileActivation

This way I could activate multiple profiles with a single property, without redefining the activation in each child pom.xml

$> mvn -inheritProfileActivation -DmyProfileSet

And if possible, I would even like to define 'inheritProfileActivation' in the parent pom, so a user would not have to define it at all. To not have to change the schema of the POM, we could use a property like:
"project.inheritProfileActivation" which could be reused in a future POM change as a tag. (same way as for 'sourceEncoding': http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding)

wdyt? I would spend time to implement this, but would this be accepted?



                
> 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
>
> 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

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Lampada updated MNG-5127:
------------------------------

    Attachment: daddy2.zip
    
> 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

        

[jira] Commented: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Joerg Schaible (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272497#comment-272497 ] 

Joerg Schaible commented on MNG-5127:
-------------------------------------

It's closed, because it behaves as designed. Profiles are always valid in the scope of the POM they are defined in, they are not inherited. The help plugin does unfortunately only show active profiles of the *current* POM, but not the ones of the parent. You have to repeat the activation for he current POM, otherwise the profile will not be active.

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=304841#comment-304841 ] 

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

Hi, 
I have attached a test case for this issue - [daddy.zip|http://jira.codehaus.org/secure/attachment/60738/daddy.zip]

The parent pom in this project defines 3 profiles with different plugin configurations: "kid", "boy" and "girl".

The 3 children want to enable different profiles:
- A kid is a kid
- A boy is a boy and a kid
- A girl is a girl and a kid

When I run "mvn help:active-profiles" I get the false hope that maven understands what I mean:

{code}
	Active Profiles for Project 'com.family:daddy:pom:1.0-SNAPSHOT': 
	There are no active profiles.

	Active Profiles for Project 'com.family:kid:pom:1.0-SNAPSHOT': 
	The following profiles are active:
	 - kid (source: pom)

	Active Profiles for Project 'com.family:boy:pom:1.0-SNAPSHOT': 
	The following profiles are active:
	 - boy (source: pom)
	 - kid (source: pom)

	Active Profiles for Project 'com.family:girl:pom:1.0-SNAPSHOT': 
	The following profiles are active:
	 - kid (source: pom)
	 - girl (source: pom)
{code}

That is: boys will be boys, girls will be girls, and both will be kids.

But when I run "mvn validate" no messages are echoed.

{code}
	[INFO] ------------------------------------------------------------------------
	[INFO] Building daddy 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building kid 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building boy 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building girl 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO] ------------------------------------------------------------------------
	[INFO] Reactor Summary:
	[INFO] 
	[INFO] daddy ............................................. SUCCESS [0.001s]
	[INFO] kid ............................................... SUCCESS [0.001s]
	[INFO] boy ............................................... SUCCESS [0.000s]
	[INFO] girl .............................................. SUCCESS [0.000s]
	[INFO] ------------------------------------------------------------------------
	[INFO] BUILD SUCCESS
{code}

The only way I can get any of those profiles to run is using -P on the command line, like "mvn validate -Pgirl"
But that would transform boys into girls and we don't want that:

{code}
	[INFO] ------------------------------------------------------------------------
	[INFO] Building daddy 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO] 
	[INFO] --- maven-antrun-plugin:1.7:run (default) @ daddy ---
	[INFO] Executing tasks

	main:
	     [echo] @@@@@@@@@@@@ HELLO! Iam a GIRL project
	[INFO] Executed tasks
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building kid 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO] 
	[INFO] --- maven-antrun-plugin:1.7:run (default) @ kid ---
	[INFO] Executing tasks

	main:
	     [echo] @@@@@@@@@@@@ HELLO! Iam a GIRL project
	[INFO] Executed tasks
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building boy 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO] 
	[INFO] --- maven-antrun-plugin:1.7:run (default) @ boy ---
	[INFO] Executing tasks

	main:
	     [echo] @@@@@@@@@@@@ HELLO! Iam a GIRL project
	[INFO] Executed tasks
	[INFO]                                                                         
	[INFO] ------------------------------------------------------------------------
	[INFO] Building girl 1.0-SNAPSHOT
	[INFO] ------------------------------------------------------------------------
	[INFO] 
	[INFO] --- maven-antrun-plugin:1.7:run (default) @ girl ---
	[INFO] Executing tasks

	main:
	     [echo] @@@@@@@@@@@@ HELLO! Iam a GIRL project
	[INFO] Executed tasks
	[INFO] ------------------------------------------------------------------------
	[INFO] Reactor Summary:
	[INFO] 
	[INFO] daddy ............................................. SUCCESS [0.682s]
	[INFO] kid ............................................... SUCCESS [0.112s]
	[INFO] boy ............................................... SUCCESS [0.099s]
	[INFO] girl .............................................. SUCCESS [0.090s]
	[INFO] ------------------------------------------------------------------------
	[INFO] BUILD SUCCESS
{code}

I think the requirement here is to be able to:
 - Define only once, what is a boy, what is a girl, and what is a kid.
 - Apply those "labels" to modules and make them *stick*, so that there's no need to use command line parameters.

It seems to me that this should be the main goal of maven profiles.
This unimplemented feature really gets in the way of good, DRY configuration and build management for big modular projects.

                
> 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: 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

        

[jira] Commented: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Gilles Scokart (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272483#comment-272483 ] 

Gilles Scokart commented on MNG-5127:
-------------------------------------

I cloned MNG-3228 because there is already a bunch of comments saying that it should be reopened, but it seems nobody is looking at the issue that are already Closed.

Feel free to close this ticket as a duplicate (and reopen the original one).

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Joerg Schaible (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272567#comment-272567 ] 

Joerg Schaible commented on MNG-5127:
-------------------------------------

Just in case you mean "activeByDefault": It's active *unless* you explicitly specify other ones to be active.

> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tony Lampada updated MNG-5127:
------------------------------

    Attachment: daddy.zip
    
> 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: 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

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=305103#comment-305103 ] 

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

I have found a "workaround" for the situation above using a build extensions.
There's a lot of room for improvement though - http://stackoverflow.com/questions/11749375/import-maven-plugin-configuration-by-composition-rather-than-inheritance-can-it
                
> 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: 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

        

[jira] Issue Comment Edited: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Karel Piwko (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272586#comment-272586 ] 

Karel Piwko edited comment on MNG-5127 at 7/7/11 10:54 AM:
-----------------------------------------------------------

This behavior makes multi-module project testing/build a mess. See following example:

Parent(aggregator) pom.xml

{code}
<profile>
    <id>linux-64bit</id>

    <activation>
        <property>
            <name>arch</name>
            <value>linux-64bit</value>
        </property>
    </activation>

    <modules>
        <module>lin-64</module>
        <module>lin-64-support</module>
    </modules>


<profile>
    <id>linux-64bit-foo</id>

    <activation>
        <property>
            <name>activation</name>
            <value>linux-64bit-foo</value>
        </property>
    </activation>

    <modules>
        <module>lin-64-foo</module>
    </modules>
</profile>

<profile>
    <id>foo</id>

    <activation>
        <property>
            <name>framework</name>
            <value>foo</value>
        </property>
    </activation>

    <modules>
        <module>foo</module>
        <module>foo-common</module>
    </modules>

...other frameworks and archs...

</profile>

{code}

Then, every module might have a specific configuration, e.g.

foo/pom.xml:

{code}
<profile>
    <id>linux-32bit</id>
    ...
</profile>
<profile>
    <id>linux-64bit</id>
    ...
</profile>

{code}

Now, supposing I want to build framework foo on arch linux-64, I have to do
{code}
mvn -Pfoo,linux-64bit,linux-64bit-foo -Dframework=foo -Darch=linux-64 -Dactivation=linux-64-foo install
{code}
leading to many "profile does not exist" errors/warnings.

In ideal Maven world where profile activation is inherited, this would do the installation:
{code}
mvn -Dframework=foo -Darch=linux-64 -Dactivation=linux-64 install
{code}
If I stick with the latter, I would have to recopy the activation to every module where applicable. Then I'll get the build configuration from the parent.

If I stick with the former, I would have to remove activation by a property and enumerate all possible combination as -P activated profiles, ignoring warnings.

Neither of the approaches helps to manage a large project with a single aggregator. 

Note: activation property is there due to http://jira.codehaus.org/browse/MNG-4565



      was (Author: kapy):
    This behavior makes multi-module project testing/build a mess. See following example:

Parent(aggregator) pom.xml

{code}
<profile>
    <id>linux-64bit</id>

    <activation>
        <property>
            <name>arch</name>
            <value>linux-64bit</value>
        </property>
    </activation>

    <modules>
        <module>lin-64</module>
        <module>lin-64-support</module>
    </modules>


<profile>
    <id>linux-64bit-foo</id>

    <activation>
        <property>
            <name>activation</name>
            <value>linux-64bit-foo</value>
        </property>
    </activation>

    <modules>
        <module>lin-64-foo</module>
    </modules>
</profile>

<profile>
    <id>foo</id>

    <activation>
        <property>
            <name>framework</name>
            <value>foo</value>
        </property>
    </activation>

    <modules>
        <module>foo</module>
        <module>foo-common</module>
    </modules>

...other frameworks and archs...

</profile>

{code}

Then, every module might have a specific configuration, e.g.

foo/pom.xml:

{code}
<profile>
    <id>linux-32bit</id>
    ...
</profile>
<profile>
    <id>linux-64bit</id>
    ...
</profile>

{code}

Now, supposing I want to build framework foo on arch linux-64, I have to do

mvn -Pfoo,linux-64bit,linux-64bit-foo -Dframework=foo -Darch=linux-64 -Dactivation=linux-64-foo install

leading to many "profile does not exist" errors/warnings.

In ideal Maven world where profile activation is inherited, this would do the installation:

mvn -Dframework=foo -Darch=linux-64 -Dactivation=linux-64 install

If I stick with the latter, I would have to recopy the activation to every module where applicable. Then I'll get the configuration from the parent.

If I stick with the former, I would have to remove activation by a property and enumerate all possible combination as -P activated profiles, ignoring warnings.

Neither of the approaches helps to manage a large project with a single aggregator. 

Note: activation property is there due to http://jira.codehaus.org/browse/MNG-4565


  
> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Karel Piwko (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=272586#comment-272586 ] 

Karel Piwko commented on MNG-5127:
----------------------------------

This behavior makes multi-module project testing/build a mess. See following example:

Parent(aggregator) pom.xml

{code}
<profile>
    <id>linux-64bit</id>

    <activation>
        <property>
            <name>arch</name>
            <value>linux-64bit</value>
        </property>
    </activation>

    <modules>
        <module>lin-64</module>
        <module>lin-64-support</module>
    </modules>


<profile>
    <id>linux-64bit-foo</id>

    <activation>
        <property>
            <name>activation</name>
            <value>linux-64bit-foo</value>
        </property>
    </activation>

    <modules>
        <module>lin-64-foo</module>
    </modules>
</profile>

<profile>
    <id>foo</id>

    <activation>
        <property>
            <name>framework</name>
            <value>foo</value>
        </property>
    </activation>

    <modules>
        <module>foo</module>
        <module>foo-common</module>
    </modules>

...other frameworks and archs...

</profile>

{code}

Then, every module might have a specific configuration, e.g.

foo/pom.xml:

{code}
<profile>
    <id>linux-32bit</id>
    ...
</profile>
<profile>
    <id>linux-64bit</id>
    ...
</profile>

{code}

Now, supposing I want to build framework foo on arch linux-64, I have to do

mvn -Pfoo,linux-64bit,linux-64bit-foo -Dframework=foo -Darch=linux-64 -Dactivation=linux-64-foo install

leading to many "profile does not exist" errors/warnings.

In ideal Maven world where profile activation is inherited, this would do the installation:

mvn -Dframework=foo -Darch=linux-64 -Dactivation=linux-64 install

If I stick with the latter, I would have to recopy the activation to every module where applicable. Then I'll get the configuration from the parent.

If I stick with the former, I would have to remove activation by a property and enumerate all possible combination as -P activated profiles, ignoring warnings.

Neither of the approaches helps to manage a large project with a single aggregator. 

Note: activation property is there due to http://jira.codehaus.org/browse/MNG-4565



> 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
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Robert Scholte (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Scholte updated MNG-5127:
--------------------------------

    Description: 
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:
{code:xml}
...
  <profile>
    <id>TONY</id>
<activation>
<property>
<name>user.name</name>
<value>WINTONY</value>
</property>
</activation>
    <properties>
    </properties>
{code}
   
So in this case, my profile is activated based on my OS user name
{noformat}
[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)
{noformat}

------------------


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
{code:xml|title=PARENT POM}
...
  <profiles>
  <profile>
    <id>TONY</id>
<activation>
<property>
<name>user.name</name>
<value>WINTONY</value>
</property>
</activation>
    <properties>
...
{code}

{code:xml|title=CHILD POM (the one being built)}
<project>
<parent>
<groupId>com.capgemini.be.proj1</groupId>
<artifactId>parent</artifactId>
<version>4.0.2</version>
</parent>
{code}

{noformat}
[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. 
{noformat}

  was:
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. 

    
> 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:
> {code:xml}
> ...
>   <profile>
>     <id>TONY</id>
> <activation>
> <property>
> <name>user.name</name>
> <value>WINTONY</value>
> </property>
> </activation>
>     <properties>
>     </properties>
> {code}
>    
> So in this case, my profile is activated based on my OS user name
> {noformat}
> [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)
> {noformat}
> ------------------
> 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
> {code:xml|title=PARENT POM}
> ...
>   <profiles>
>   <profile>
>     <id>TONY</id>
> <activation>
> <property>
> <name>user.name</name>
> <value>WINTONY</value>
> </property>
> </activation>
>     <properties>
> ...
> {code}
> {code:xml|title=CHILD POM (the one being built)}
> <project>
> <parent>
> <groupId>com.capgemini.be.proj1</groupId>
> <artifactId>parent</artifactId>
> <version>4.0.2</version>
> </parent>
> {code}
> {noformat}
> [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. 
> {noformat}

--
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

        

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
    [ 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

       

[jira] (MNG-5127) CLONE - Maven profile activation does not work when profile is defined in inherited 'parent' pom

Posted by "Tony Lampada (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MNG-5127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=305103#comment-305103 ] 

Tony Lampada edited comment on MNG-5127 at 7/31/12 4:38 PM:
------------------------------------------------------------

I have found a "workaround" for the situation above using a build extension.
There's a lot of room for improvement though - http://stackoverflow.com/questions/11749375/import-maven-plugin-configuration-by-composition-rather-than-inheritance-can-it
                
      was (Author: tonylampada):
    I have found a "workaround" for the situation above using a build extensions.
There's a lot of room for improvement though - http://stackoverflow.com/questions/11749375/import-maven-plugin-configuration-by-composition-rather-than-inheritance-can-it
                  
> 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: 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