Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-2309

Profile activation order is random

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4
    • 2.0.5
    • Reactor and Workspace
    • None
    • all

    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.

      Attachments

        Issue Links

          Activity

            People

              kenneyw kenneyw
              kenney Kenney Westerhof
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: