You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2008/03/06 21:15:24 UTC

svn commit: r634403 - /maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

Author: jdcasey
Date: Thu Mar  6 12:15:22 2008
New Revision: 634403

URL: http://svn.apache.org/viewvc?rev=634403&view=rev
Log:
[MNG-3394] Reenabling the project.injectPluginManagementInfo(..) call in DefaultLifecycleExecutor.getMojoDescriptor(..), but also moving the project-plugin search out of the 2-token condition where the prefix is resolved, to below all of the token-parsing but just above the injectPluginManagementInfo call, to allow the project-plugin's version to override if it exists. This fixes the case where the lifecycle specifies a plugin but the project's build/plugins doesn't have the version in it...but the project's build/pluginManagement does.

Modified:
    maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

Modified: maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=634403&r1=634402&r2=634403&view=diff
==============================================================================
--- maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Thu Mar  6 12:15:22 2008
@@ -1551,17 +1551,6 @@
                     plugin.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
                     plugin.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( prefix ) );
                 }
-
-                for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
-                {
-                    Plugin buildPlugin = (Plugin) i.next();
-
-                    if ( buildPlugin.getKey().equals( plugin.getKey() ) )
-                    {
-                        plugin = buildPlugin;
-                        break;
-                    }
-                }
             }
             else if ( ( numTokens == 3 ) || ( numTokens == 4 ) )
             {
@@ -1584,7 +1573,21 @@
                 throw new BuildFailureException( message );
             }
 
-//            project.injectPluginManagementInfo( plugin );
+            if ( plugin.getVersion() == null )
+            {
+                for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
+                {
+                    Plugin buildPlugin = (Plugin) i.next();
+
+                    if ( buildPlugin.getKey().equals( plugin.getKey() ) )
+                    {
+                        plugin = buildPlugin;
+                        break;
+                    }
+                }
+
+                project.injectPluginManagementInfo( plugin );
+            }
 
             if ( pluginDescriptor == null )
             {