Issue Details (XML | Word | Printable)

Key: MNG-3545
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul Gier
Reporter: David Bernhard
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 2

Option -P-profile overridden if profile is activebyDefault

Created: 24/Apr/08 02:35 AM   Updated: 03/Sep/08 04:59 PM
Component/s: Profiles
Affects Version/s: 2.0.9
Fix Version/s: 2.0.10, 2.1.0-M1

Time Tracking:
Not Specified

File Attachments: 1. Zip Archive maven-profile-bug.zip (0.6 kB)
2. Text File MNG-3545-profiles.patch (1 kB)

Issue Links:
Duplicate
 
Related
 
dependent
 

Complexity: Intermediate
Testcase included: yes
Patch Submitted: Yes


 Description  « Hide
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".



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
David Bernhard added a comment - 24/Apr/08 04:02 AM
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?

David Bernhard added a comment - 24/Apr/08 04:03 AM
The patch file. The technique works for 2.0.9 too; in 2.1 use "-P+foo" to turn off foo with this patch.

Paul Benedict added a comment - 01/May/08 12:33 PM - 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.

Paul Gier added a comment - 01/May/08 01:05 PM
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.

Paul Gier added a comment - 15/May/08 04:23 PM
I added an integration test for this and it seems to be working correctly now.

John Casey added a comment - 03/Sep/08 04:59 PM
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.