[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 );
if ( existing != null )
{
if ( existing.getVersion() == null )
{
existing.setVersion( plugin.getVersion() );
}
plugin = existing;
}
else

View File

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

View File

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

View File

@ -1453,7 +1453,7 @@ public class PomConstructionTest
throws Exception
{
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()

View File

@ -66,7 +66,13 @@ public class DefaultReportingConverter
{
sitePlugin = new 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();

View File

@ -69,6 +69,8 @@ under the License.
</testResource>
</testResources>
<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>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
@ -78,74 +80,14 @@ under the License.
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</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>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</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>
</pluginManagement>
</build>