Maven 2 & 3

activeProfile in ~/.m2/settings.xml is ignored when profiles section is missing or empty

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0.4
  • Fix Version/s: 2.0.9
  • Component/s: Profiles, Settings
  • Labels:
    None
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

When i have this settings.xml file in my user home dir, the activeProfile setting is simply ignored by Maven:
<settings>
<activeProfiles>
<activeProfile>env-test</activeProfile>
</activeProfiles>
</settings>

Adding an empty profiles section does not help:
<settings>
<profiles>
</profiles>
<activeProfiles>
<activeProfile>env-test</activeProfile>
</activeProfiles>
</settings>

Well, adding a dummy profile makes it work:
<settings>
<profiles>
<profile>
<id>dummy</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>env-test</activeProfile>
</activeProfiles>
</settings>

Funny, isn't it?

Regards,
Manfred

Issue Links

Activity

Hide
John Casey added a comment -

Assuming the activeProfiles section is only there to activate profiles that you've provided, how would you expect this to act?

Show
John Casey added a comment - Assuming the activeProfiles section is only there to activate profiles that you've provided, how would you expect this to act?
Hide
Manfred Geiler added a comment -

The actual profiles are defined in the pom.xml files (= best practice for environment settings - see http://maven.apache.org/guides/introduction/introduction-to-profiles.html).
To activate one of these profiles without always having to add a -P foobar option on the command line, it makes perfect sense to have this profile activation in the user's settings.xml.
And it really works. But only when there is a dummy profile in the settings.xml file.

Show
Manfred Geiler added a comment - The actual profiles are defined in the pom.xml files (= best practice for environment settings - see http://maven.apache.org/guides/introduction/introduction-to-profiles.html). To activate one of these profiles without always having to add a -P foobar option on the command line, it makes perfect sense to have this profile activation in the user's settings.xml. And it really works. But only when there is a dummy profile in the settings.xml file.
Hide
Mathias Arens added a comment -

I have the same problem with 2.0.7 and it would be great if this problem would be fixed in 2.0.8.

Show
Mathias Arens added a comment - I have the same problem with 2.0.7 and it would be great if this problem would be fixed in 2.0.8.
Hide
Jason van Zyl added a comment -

After chatting with John, we can turn this on because a proposal is forth coming that will limit downstream profile activation to os, jdk, and activeByDefault. Everything else should be ignored. So we can let users turn on profiles in their settings but this begs the question, what is not being triggered by default in the project you're working on?

Show
Jason van Zyl added a comment - After chatting with John, we can turn this on because a proposal is forth coming that will limit downstream profile activation to os, jdk, and activeByDefault. Everything else should be ignored. So we can let users turn on profiles in their settings but this begs the question, what is not being triggered by default in the project you're working on?
Hide
Krystian Nowak added a comment -

It seems to be a duplicate of http://jira.codehaus.org/browse/MNG-3051

Show
Krystian Nowak added a comment - It seems to be a duplicate of http://jira.codehaus.org/browse/MNG-3051

People

Vote (7)
Watch (7)

Dates

  • Created:
    Updated:
    Resolved: