[MNG-4453] [regression] Plugin versions defined in a lifecycle mapping are not respected

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@932609 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-04-09 20:59:09 +00:00
parent 4d45299116
commit 0c20759680
6 changed files with 197 additions and 129 deletions

View File

@ -146,6 +146,10 @@ public class LifecyclePluginAnalyzerImpl
Plugin existing = plugins.get( plugin ); Plugin existing = plugins.get( plugin );
if ( existing != null ) if ( existing != null )
{ {
if ( existing.getVersion() == null )
{
existing.setVersion( plugin.getVersion() );
}
plugin = existing; plugin = existing;
} }
else else

View File

@ -34,8 +34,12 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: pom-lifecycle --> <!-- START SNIPPET: pom-lifecycle -->
<phases> <phases>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: pom-lifecycle --> <!-- END SNIPPET: pom-lifecycle -->
</lifecycle> </lifecycle>
@ -67,14 +71,30 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: jar-lifecycle --> <!-- START SNIPPET: jar-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources> </process-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> <compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
<package>org.apache.maven.plugins:maven-jar-plugin:jar</package> </compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <process-test-resources>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources>
<test-compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
</test-compile>
<test>
org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:2.3:jar
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: jar-lifecycle --> <!-- END SNIPPET: jar-lifecycle -->
</lifecycle> </lifecycle>
@ -109,23 +129,29 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: ejb-lifecycle --> <!-- START SNIPPET: ejb-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources <process-resources>
org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
</process-resources> </process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile <compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
</compile> </compile>
<process-test-resources> <process-test-resources>
org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources> </process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile <test-compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
</test-compile> </test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test <test>
org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test> </test>
<package> <package>
org.apache.maven.plugins:maven-ejb-plugin:ejb org.apache.maven.plugins:maven-ejb-plugin:2.1:ejb
</package> </package>
<install>org.apache.maven.plugins:maven-install-plugin:install <install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install> </install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy <deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy> </deploy>
</phases> </phases>
<!-- END SNIPPET: ejb-lifecycle --> <!-- END SNIPPET: ejb-lifecycle -->
@ -169,14 +195,30 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: ejb3-lifecycle --> <!-- START SNIPPET: ejb3-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources> </process-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> <compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
<package>org.apache.maven.plugins:maven-ejb3-plugin:ejb3</package> </compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <process-test-resources>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources>
<test-compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
</test-compile>
<test>
org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-ejb3-plugin:ejb3
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: ejb3-lifecycle --> <!-- END SNIPPET: ejb3-lifecycle -->
</lifecycle> </lifecycle>
@ -227,15 +269,34 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: maven-plugin-lifecycle --> <!-- START SNIPPET: maven-plugin-lifecycle -->
<phases> <phases>
<generate-resources>org.apache.maven.plugins:maven-plugin-plugin:descriptor</generate-resources> <generate-resources>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> org.apache.maven.plugins:maven-plugin-plugin:2.5.1:descriptor
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> </generate-resources>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources <process-resources>
</process-test-resources><test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> </process-resources>
<package>org.apache.maven.plugins:maven-jar-plugin:jar,org.apache.maven.plugins:maven-plugin-plugin:addPluginArtifactMetadata</package> <compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> </compile>
<process-test-resources>
org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources>
<test-compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
</test-compile>
<test>
org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-jar-plugin:2.3:jar,
org.apache.maven.plugins:maven-plugin-plugin:2.5.1:addPluginArtifactMetadata
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: maven-plugin-lifecycle --> <!-- END SNIPPET: maven-plugin-lifecycle -->
</lifecycle> </lifecycle>
@ -302,16 +363,30 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: war-lifecycle --> <!-- START SNIPPET: war-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
</process-resources>
<compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
</compile>
<process-test-resources> <process-test-resources>
org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources> </process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> <test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
<package>org.apache.maven.plugins:maven-war-plugin:war</package> </test-compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <test>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-war-plugin:2.1-beta-1:war
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: war-lifecycle --> <!-- END SNIPPET: war-lifecycle -->
</lifecycle> </lifecycle>
@ -345,12 +420,20 @@ problem.
<!-- START SNIPPET: ear-lifecycle --> <!-- START SNIPPET: ear-lifecycle -->
<phases> <phases>
<generate-resources> <generate-resources>
org.apache.maven.plugins:maven-ear-plugin:generate-application-xml org.apache.maven.plugins:maven-ear-plugin:2.4.1:generate-application-xml
</generate-resources> </generate-resources>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<package>org.apache.maven.plugins:maven-ear-plugin:ear</package> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
<install>org.apache.maven.plugins:maven-install-plugin:install</install> </process-resources>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> <package>
org.apache.maven.plugins:maven-ear-plugin:2.4.1:ear
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: ear-lifecycle --> <!-- END SNIPPET: ear-lifecycle -->
</lifecycle> </lifecycle>
@ -383,16 +466,30 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: rar-lifecycle --> <!-- START SNIPPET: rar-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
</process-resources>
<compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
</compile>
<process-test-resources> <process-test-resources>
org.apache.maven.plugins:maven-resources-plugin:testResources org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources> </process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> <test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
<package>org.apache.maven.plugins:maven-rar-plugin:rar</package> </test-compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <test>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-rar-plugin:2.2:rar
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: rar-lifecycle --> <!-- END SNIPPET: rar-lifecycle -->
</lifecycle> </lifecycle>
@ -425,14 +522,30 @@ problem.
<id>default</id> <id>default</id>
<!-- START SNIPPET: par-lifecycle --> <!-- START SNIPPET: par-lifecycle -->
<phases> <phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources> <process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile> org.apache.maven.plugins:maven-resources-plugin:2.4.2:resources
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources> </process-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile> <compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test> org.apache.maven.plugins:maven-compiler-plugin:2.1:compile
<package>org.apache.maven.plugins:maven-par-plugin:par</package> </compile>
<install>org.apache.maven.plugins:maven-install-plugin:install</install> <process-test-resources>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy> org.apache.maven.plugins:maven-resources-plugin:2.4.2:testResources
</process-test-resources>
<test-compile>
org.apache.maven.plugins:maven-compiler-plugin:2.1:testCompile
</test-compile>
<test>
org.apache.maven.plugins:maven-surefire-plugin:2.5:test
</test>
<package>
org.apache.maven.plugins:maven-par-plugin:par
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:2.3:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
</deploy>
</phases> </phases>
<!-- END SNIPPET: par-lifecycle --> <!-- END SNIPPET: par-lifecycle -->
</lifecycle> </lifecycle>

View File

@ -97,7 +97,8 @@
<phase>post-clean</phase> <phase>post-clean</phase>
</phases> </phases>
<default-phases> <default-phases>
<clean>org.apache.maven.plugins:maven-clean-plugin:clean <clean>
org.apache.maven.plugins:maven-clean-plugin:2.4:clean
</clean> </clean>
</default-phases> </default-phases>
</lifecycle> </lifecycle>
@ -110,9 +111,11 @@
<phase>site-deploy</phase> <phase>site-deploy</phase>
</phases> </phases>
<default-phases> <default-phases>
<site>org.apache.maven.plugins:maven-site-plugin:site <site>
org.apache.maven.plugins:maven-site-plugin:2.0.1:site
</site> </site>
<site-deploy>org.apache.maven.plugins:maven-site-plugin:deploy <site-deploy>
org.apache.maven.plugins:maven-site-plugin:2.0.1:deploy
</site-deploy> </site-deploy>
</default-phases> </default-phases>
</lifecycle> </lifecycle>

View File

@ -1453,7 +1453,7 @@ public class PomConstructionTest
throws Exception throws Exception
{ {
PomTestWrapper pom = this.buildPom( "plugin-management-duplicate/sub"); PomTestWrapper pom = this.buildPom( "plugin-management-duplicate/sub");
assertEquals( 20, ( (List<?>) pom.getValue( "build/pluginManagement/plugins" ) ).size() ); assertEquals( 12, ( (List<?>) pom.getValue( "build/pluginManagement/plugins" ) ).size() );
} }
public void testDistributionManagement() public void testDistributionManagement()

View File

@ -66,7 +66,13 @@ public class DefaultReportingConverter
{ {
sitePlugin = new Plugin(); sitePlugin = new Plugin();
sitePlugin.setArtifactId( "maven-site-plugin" ); sitePlugin.setArtifactId( "maven-site-plugin" );
build.addPlugin( sitePlugin ); PluginManagement pluginManagement = build.getPluginManagement();
if ( pluginManagement == null )
{
pluginManagement = new PluginManagement();
build.setPluginManagement( pluginManagement );
}
pluginManagement.addPlugin( sitePlugin );
} }
Xpp3Dom configuration = (Xpp3Dom) sitePlugin.getConfiguration(); Xpp3Dom configuration = (Xpp3Dom) sitePlugin.getConfiguration();

View File

@ -69,6 +69,8 @@ under the License.
</testResource> </testResource>
</testResources> </testResources>
<pluginManagement> <pluginManagement>
<!-- NOTE: These plugins will be removed from future versions of the super POM -->
<!-- They are kept for the moment as they are very unlikely to conflict with lifecycle mappings (MNG-4453) -->
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
@ -78,74 +80,14 @@ under the License.
<artifactId>maven-assembly-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version> <version>2.2-beta-5</version>
</plugin> </plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin> <plugin>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version> <version>2.1</version>
</plugin> </plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>2.5.1</version>
</plugin>
<plugin>
<artifactId>maven-rar-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin> <plugin>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.0</version> <version>2.0</version>
</plugin> </plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.2</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>2.0.1</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>