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

Default profile in settings.xml must not use an id possibly already in use.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Not A Problem
    • needing-scrub-3.4.0-fallout
    • None
    • None
    • None

    Description

      I have created a simple example project with the following pom file:

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.soebes.maven.example</groupId>
        <artifactId>example</artifactId>
        <packaging>jar</packaging>
        <version>1.0-SNAPSHOT</version>
      
        <properties>
          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
      
        <build>
          <pluginManagement>
            <plugins>
              <plugin>
                <groupId>com.soebes.maven.plugins</groupId>
                <artifactId>echo-maven-plugin</artifactId>
                <version>0.3.0</version>
              </plugin>
            </plugins>
          </pluginManagement>
        </build>
      
        <profiles>
          <profile>
            <activation>
              <property>
                <name>performRelease</name>
                <value>true</value>
              </property>
            </activation>
            <build>
              <plugins>
                <plugin>
                  <groupId>com.soebes.maven.plugins</groupId>
                  <artifactId>echo-maven-plugin</artifactId>
                  <executions>
                    <execution>
                      <phase>initialize</phase>
                      <goals>
                        <goal>echo</goal>
                      </goals>
                    </execution>
                  </executions>
                  <configuration>
                    <echos>
                      <echo>Profile: performRelease property is activated '${performRelease}'.</echo>
                    </echos>
                  </configuration>
                </plugin>
              </plugins>
            </build>
          </profile>
        </profiles>
      </project>
      

      If I use Maven 3.3.9 (also 3.0.5, 3.1.1, 3.2.5) and run it like this:

      ~/ws-git-maven-bugs/profiles (master)$ mvn initialize
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building example 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.401 s
      [INFO] Finished at: 2016-07-23T18:11:47+02:00
      [INFO] Final Memory: 7M/245M
      [INFO] ------------------------------------------------------------------------
      

      If I run the current master of Maven Core (sha: 90f26c279af9738735be8f84f60dcf21b6244e24) I got the following result:

      ~/ws-git-maven-bugs/profiles (master)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building example 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO]
      [INFO] --- echo-maven-plugin:0.3.0:echo (default) @ example ---
      [INFO] Profile: performRelease property is activated '${performRelease}'.
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.478 s
      [INFO] Finished at: 2016-07-23T18:12:54+02:00
      [INFO] Final Memory: 9M/245M
      [INFO] ------------------------------------------------------------------------
      

      This means the profile will be erroneously activated but the property does not contain a value.

      If I add an id to the profile like this:

        <profiles>
          <profile>
            <id>an-other-profile</id>
            <activation>
              <property>
                <name>performRelease</name>
                <value>true</value>
              </property>
            </activation>
        ..
      

      It will produce the following (correct) result:

      ~/ws-git-maven-bugs/profiles (master *)$ ~/tools/maven-test/apache-maven-3.4.0-SNAPSHOT/bin/mvn initialize
      [INFO] Scanning for projects...
      [INFO]
      [INFO] ------------------------------------------------------------------------
      [INFO] Building example 1.0-SNAPSHOT
      [INFO] ------------------------------------------------------------------------
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 0.279 s
      [INFO] Finished at: 2016-07-23T18:18:23+02:00
      [INFO] Final Memory: 8M/245M
      [INFO] ------------------------------------------------------------------------
      

      I have create a full working example here: https://github.com/khmarbaise/mng-6070

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              khmarbaise Karl Heinz Marbaise
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: