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

[regression] Plugins are not properly ordered after merging with profile plugins

    XMLWordPrintableJSON

    Details

      Description

      Basically the same as MNG-4415 just in the context of profiles. E.g. for a POM with

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.its.plugins</groupId>
            <artifactId>maven-it-plugin-b</artifactId>
            <version>2.1-SNAPSHOT</version>
          </plugin>
        </plugins>
      </build>
      <profiles>
        <profile>
          <id>test</id>
          <build>
            <plugins>
              <plugin>
                <groupId>org.apache.maven.its.plugins</groupId>
                <artifactId>maven-it-plugin-a</artifactId>
                <version>2.1-SNAPSHOT</version>
              </plugin>
              <plugin>
                <groupId>org.apache.maven.its.plugins</groupId>
                <artifactId>maven-it-plugin-b</artifactId>
                <version>2.1-SNAPSHOT</version>
              </plugin>
            </plugins>
          </build>
        </profile>
      </profiles>
      

      the effective model erroneously ends up with the wrong plugin order as shown below when the profile is activated:

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.its.plugins</groupId>
            <artifactId>maven-it-plugin-b</artifactId>
            <version>2.1-SNAPSHOT</version>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.its.plugins</groupId>
            <artifactId>maven-it-plugin-a</artifactId>
            <version>2.1-SNAPSHOT</version>
          </plugin>
        </plugins>
      </build>
      

      In general, profile injection is expected to work like this when merging the plugin lists:

      model:   X -> A -> B -> D -> E
      profile: Y -> A -> C -> D -> F
      result:  X -> Y -> A -> B -> C -> D -> E -> F
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bentmann Benjamin Bentmann
                Reporter:
                bentmann Benjamin Bentmann
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: