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

settings.xml active profiles executed AFTER project profiles have been loaded and activated/not activated

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 2.0.9
    • None
    • None
    • Solaris 5.10, ubuntu hardy x64

    Description

      If you have the following settings.xml in ~/.m2:

      <?xml version="1.0" encoding="UTF-8"?>
      <settings>
        <profiles>
          <profile>
            <id>userSettings</id>
            <activation>
              <activeByDefault/>
            </activation>
            <properties>
              <someproperty>true</someproperty>
            </properties>
          </profile>
        </profiles>
        <activeProfiles>
          <activeProfile>userSettings</activeProfile>
        </activeProfiles>
      </settings>
      

      and another child pom.xml somewhere down the line has a profile with an activation like this:

      <project xmlns="http://maven.apache.org/POM/4.0.0">
        <modelVersion>4.0.0</modelVersion>
        <profiles>
          <profile>
          	<id>with-something</id>    
          	<activation>
             		<activeByDefault>false</activeByDefault>
             		<property>
             			<name>someproperty</name>
             			<value>true</value>
             		</property>
          	</activation>
          </profile>
        </profiles>    
      </project>
      

      During run-time, the profile with-something will load before userSettings. This causes with-something to be incorrectly not activated (as the property someproperty does not exist). This can be seen with mvn help:active-profiles.

      I know why this is true, but it is non-intuitive and one would expect settings.xml profiles to be loaded before anything else.

      Attachments

        Issue Links

          Activity

            People

              bentmann Benjamin Bentmann
              donabrams Donald Abrams
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: