You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Abhishekh Padmanbhan (JIRA)" <ji...@codehaus.org> on 2010/02/17 16:30:55 UTC

[jira] Issue Comment Edited: (MNG-3229) Active by default profile is ignored when another is specified explicitly.

    [ http://jira.codehaus.org/browse/MNG-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=208630#action_208630 ] 

Abhishekh Padmanbhan edited comment on MNG-3229 at 2/17/10 9:30 AM:
--------------------------------------------------------------------

I dont think setting a profile activeByDefault really does what it is suppoded to or at least not what the document says. Find below the link that has the description of the issue

http://markmail.org/message/5xfhhzrmkiakxvzr

The workaround that I am using currently is

{code:xml}
<profiles>
   <profile>
      <id>dev</id>
      <activation>
         <property>
            <name>env</name>
            <value>dev</value>
          </property>
      </activation>
     <properties>
       <blah>true</blah>
     </properties>
    </profile>
    <profile>
       <id>prod</id>
       <activation>
          <property>
            <name>env</name>
            <value>prod</value>
          </property>
       </activation>
       <properties>
          <blah>false</blah>
       </properties>
     </profile>
     <profile>
       <id>qa</id>
       <activation>
           <property> 
              <name>env</name>
              <value>qa</value>
            </property>
       </activation>
       <properties>
           <blah>false</blah>
       </properties>
   </profile>
   <activeProfiles>
       <activeProfile>dev</activeProfile>
   </activeProfiles>
</profiles>
{code}

So I have the default profile to be the the active profile and make sure the default profile description (here dev) is listed as the first profile in the settings.xml. So if i activated any other profile through its respective activation condition it would override the default profile. Although both profiles are really active it looks like the one that is defined the last in the settings.xml overrides the previous ones.


      was (Author: abhishekhp):
    I dont think setting a profile activeByDefault really does what it is suppoded to or at least not what the document says. Find below the link that has the description of the issue

http://markmail.org/message/5xfhhzrmkiakxvzr

The workaround that I am using currently is

<profiles>
   <profile>
        <id>dev</id>
  <activation> <property> <name>env</name> <value>dev</value> </property> </activation>
     <properties><blah>true</blah></properties>
     </profile>
    <profile>
       <id>prod</id>
        <activation> <property> <name>env</name> <value>prod</value> </property> </activation>
<properties><blah>false</blah></properties>
     </profile>
     <profile>
        <id>qa</id>
       <activation> <property> <name>env</name> <value>qa</value> </property> </activation>
<properties><blah>false</blah></properties>
      </profile>
<activeProfiles>
 <activeProfile>dev</activeProfile>
</activeProfiles>

 </profiles>

So I have the default profile to be the the active profile and make sure the default profile description (here dev) is listed as the first profile in the settings.xml. So if i activated any other profile through its respective activation condition it would override the default profile. Although both profiles are really active it looks like the one that is defined the last in the settings.xml overrides the previous ones.

  
> Active by default  profile is ignored when another is specified explicitly.
> ---------------------------------------------------------------------------
>
>                 Key: MNG-3229
>                 URL: http://jira.codehaus.org/browse/MNG-3229
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Profiles
>    Affects Versions: 2.0.7
>            Reporter: Oleksandr Maksymchuk
>             Fix For: Documentation Deficit
>
>
> When default profile is added its used only when there is no another profile specified to be used on command line via -P option.
> So in the pom containig:
> 		<profile>
> 			<id>default</id>
> 			<activation>
> 				<activeByDefault>true</activeByDefault>
> 			</activation>
> 		<profile>
> 			<id>dev</id>
> 			<!-- Not active, should be called explicitly. -->
> default profile is used only when running command without -P dev
> mvn 
> but not used when running:
> mvn -P dev
> Expected: should be used in both variants as per doc.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira