Maven 2 & 3

Option -P-profile overridden if profile is activebyDefault

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 2.0.9
  • Fix Version/s: 2.0.10, 2.1.0-M1
  • Component/s: Profiles
  • Labels:
    None
  • Complexity:
    Intermediate
  • Testcase included:
    yes
  • Patch Submitted:
    Yes
  • Number of attachments :
    2

Description

In maven 2.0.9, deactivating a profile "foo" that is declared and marked activeByDefault in the local POM does not work, as in DefaultProfileManager.java:227 all activeByDefault profiles are added if no profile is explicitly given ("-Pbar").

In the attached zip, run
mvn -P-foo help:active-profiles
and note that foo is active.

The patch fixes these issues by checking all default-activated profiles against the exclusions list when they are added "by default".

Issue Links

Activity

Hide
David Bernhard added a comment -

While making the patch for trunk : Is it intentional that the roles of + and - are swapped, i.e. +foo deactivates foo yet -foo activates it?

Show
David Bernhard added a comment - While making the patch for trunk : Is it intentional that the roles of + and - are swapped, i.e. +foo deactivates foo yet -foo activates it?
Hide
David Bernhard added a comment -

The patch file. The technique works for 2.0.9 too; in 2.1 use "-P+foo" to turn off foo with this patch.

Show
David Bernhard added a comment - The patch file. The technique works for 2.0.9 too; in 2.1 use "-P+foo" to turn off foo with this patch.
Hide
Paul Benedict added a comment - - edited

I hope + (or nothing at all) means activate, and - means deactivate. It's just natural to understand the minus sign as subtraction, in which you are taking away something that already exists.

Show
Paul Benedict added a comment - - edited I hope + (or nothing at all) means activate, and - means deactivate. It's just natural to understand the minus sign as subtraction, in which you are taking away something that already exists.
Hide
Paul Gier added a comment -

Yes,+ or nothing for activate and - for deactivate, that is my understanding.
I'll test 2.1 also to make sure that the behaviour is the same.

Show
Paul Gier added a comment - Yes,+ or nothing for activate and - for deactivate, that is my understanding. I'll test 2.1 also to make sure that the behaviour is the same.
Hide
Paul Gier added a comment -

I added an integration test for this and it seems to be working correctly now.

Show
Paul Gier added a comment - I added an integration test for this and it seems to be working correctly now.
Hide
John Casey added a comment -

Adding fix-for for both 2.0.10 and 2.1.0-M1, since 2.1.0-M1 will actually be released first and may not incorporate all of the eventual issue fixes released in 2.0.10.

Show
John Casey added a comment - Adding fix-for for both 2.0.10 and 2.1.0-M1, since 2.1.0-M1 will actually be released first and may not incorporate all of the eventual issue fixes released in 2.0.10.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: