Maven 2 & 3

Profile activation order is random

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
  • Fix Version/s: 2.0.5
  • Component/s: Reactor and workspace
  • Labels:
    None
  • Environment:
    all
  • Complexity:
    Intermediate
  • Number of attachments :
    0

Description

The order in which profiles are activated is currently random.

Say you have two profiles:

<profile>
  <id>default</id>
  <properties>
    <test>DEFAULT</test>
  </properties>
</profile>

<profile>
  <id>override</id>
  <properties>
    <test>OVERRIDE</test>
  </properties>
</profile>

and you run

mvn projecthelp:effective-pom -Pdefault,override

on any pom, then then <properties> section at the bottom will
probably show

<test>DEFAULT</test>
.

The same happens if you specify '<activeProfiles><activeProfile>default</..></..>' and run with 'mvn -Poverride'.

This breaks overriding settings since the merge order is random because DefaultProfileManager uses
a HashMap to add active profiles, and HashMap iterators are random.

Proposed fix is to use a LinkedHashMap.

Issue Links

Activity

Hide
Kenney Westerhof added a comment -

Fixed in trunk revision 408021.

Merged in 2.0.x branch in revision 408023.

Show
Kenney Westerhof added a comment - Fixed in trunk revision 408021. Merged in 2.0.x branch in revision 408023.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: