From 85fe4598567d8ef70ac405023c1ad50d188e3ff5 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Mon, 3 Oct 2005 13:10:39 +0000 Subject: [PATCH] PR: MNG-644 remove deprecated goal syntax git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293328 13f79535-47bb-0310-9956-ffa450edef68 --- .../lifecycle/DefaultLifecycleExecutor.java | 30 -------- maven-model/maven.mdo | 16 ----- .../apache/maven/project/MavenProject.java | 16 ----- .../org/apache/maven/project/ModelUtils.java | 72 ------------------- .../CanonicalProjectBuilderTest.java | 22 +++--- .../src/test/resources/canonical-pom.xml | 12 ++-- 6 files changed, 19 insertions(+), 149 deletions(-) diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index 74d2c5cfbe..122cb0271b 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -27,7 +27,6 @@ import org.apache.maven.execution.ReactorManager; import org.apache.maven.extension.ExtensionManager; import org.apache.maven.lifecycle.mapping.LifecycleMapping; import org.apache.maven.model.Extension; -import org.apache.maven.model.Goal; import org.apache.maven.model.Plugin; import org.apache.maven.model.PluginExecution; import org.apache.maven.model.PluginManagement; @@ -1037,8 +1036,6 @@ public class DefaultLifecycleExecutor // use the plugin if inherit was true in a base class, or it is in the current POM, otherwise use the default inheritence setting if ( plugin.isInheritanceApplied() || pluginDescriptor.isInheritedByDefault() ) { - bindGoalMapToLifecycle( pluginDescriptor, plugin.getGoalsAsMap(), phaseMap, settings ); - List executions = plugin.getExecutions(); if ( executions != null ) @@ -1074,33 +1071,6 @@ public class DefaultLifecycleExecutor return pluginDescriptor; } - /** - * @deprecated - */ - private void bindGoalMapToLifecycle( PluginDescriptor pluginDescriptor, Map goalMap, Map phaseMap, - Settings settings ) - { - for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); ) - { - MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next(); - - Goal goal = (Goal) goalMap.get( mojoDescriptor.getGoal() ); - - if ( goal != null ) - { - // We have to check to see that the inheritance rules have been applied before binding this mojo. - if ( mojoDescriptor.isInheritedByDefault() ) - { - if ( mojoDescriptor.getPhase() != null ) - { - MojoExecution mojoExecution = new MojoExecution( mojoDescriptor ); - addToLifecycleMappings( phaseMap, mojoDescriptor.getPhase(), mojoExecution, settings ); - } - } - } - } - } - private void bindExecutionToLifecycle( PluginDescriptor pluginDescriptor, Map phaseMap, PluginExecution execution, Settings settings ) throws LifecycleExecutionException diff --git a/maven-model/maven.mdo b/maven-model/maven.mdo index e7b5602a57..1cfbcafd55 100644 --- a/maven-model/maven.mdo +++ b/maven-model/maven.mdo @@ -2516,22 +2516,6 @@ - - - Goal - 4.0.0 - - - id - 4.0.0 - String - - - configuration - DOM - - - DependencyManagement 4.0.0 diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index b8c9bf28e7..9de57f53ef 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -30,7 +30,6 @@ import org.apache.maven.model.Dependency; import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.Developer; import org.apache.maven.model.DistributionManagement; -import org.apache.maven.model.Goal; import org.apache.maven.model.IssueManagement; import org.apache.maven.model.License; import org.apache.maven.model.MailingList; @@ -1234,21 +1233,6 @@ public class MavenProject { dom = (Xpp3Dom) plugin.getConfiguration(); - // TODO: this part is deprecated - if ( goalId != null ) - { - Goal goal = (Goal) plugin.getGoalsAsMap().get( goalId ); - if ( goal != null ) - { - Xpp3Dom goalConfiguration = (Xpp3Dom) goal.getConfiguration(); - if ( goalConfiguration != null ) - { - Xpp3Dom newDom = new Xpp3Dom( goalConfiguration ); - dom = Xpp3Dom.mergeXpp3Dom( newDom, dom ); - } - } - } - if ( executionId != null ) { PluginExecution execution = (PluginExecution) plugin.getExecutionsAsMap().get( executionId ); diff --git a/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java b/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java index 2813f07839..552f83d7a9 100644 --- a/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java +++ b/maven-project/src/main/java/org/apache/maven/project/ModelUtils.java @@ -26,7 +26,6 @@ import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.Exclusion; import org.apache.maven.model.Extension; -import org.apache.maven.model.Goal; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.model.Plugin; @@ -199,9 +198,6 @@ public final class ModelUtils child.setVersion( parent.getVersion() ); } - // merge the lists of goals that are not attached to an - mergeGoalContainerDefinitions( child, parent ); - // from here to the end of the method is dealing with merging of the section. String parentInherited = parent.getInherited(); @@ -330,74 +326,6 @@ public final class ModelUtils } - /** - * @param child - * @param parent - * @deprecated - */ - private static void mergeGoalContainerDefinitions( Plugin child, Plugin parent ) - { - List parentGoals = parent.getGoals(); - - // if the supplemental goals are non-existent, then nothing related to goals changes. - if ( parentGoals != null && !parentGoals.isEmpty() ) - { - Map assembledGoals = new TreeMap(); - - Map childGoals = child.getGoalsAsMap(); - - if ( childGoals != null ) - { - for ( Iterator it = parentGoals.iterator(); it.hasNext(); ) - { - Goal parentGoal = (Goal) it.next(); - - Goal assembledGoal = parentGoal; - - Goal childGoal = (Goal) childGoals.get( parentGoal.getId() ); - - if ( childGoal != null ) - { - Xpp3Dom childGoalConfig = (Xpp3Dom) childGoal.getConfiguration(); - Xpp3Dom parentGoalConfig = (Xpp3Dom) parentGoal.getConfiguration(); - - childGoalConfig = Xpp3Dom.mergeXpp3Dom( childGoalConfig, parentGoalConfig ); - - childGoal.setConfiguration( childGoalConfig ); - - assembledGoal = childGoal; - } - - assembledGoals.put( assembledGoal.getId(), assembledGoal ); - } - - for ( Iterator it = childGoals.entrySet().iterator(); it.hasNext(); ) - { - Map.Entry entry = (Map.Entry) it.next(); - - String key = (String) entry.getKey(); - Goal childGoal = (Goal) entry.getValue(); - - if ( !assembledGoals.containsKey( key ) ) - { - assembledGoals.put( key, childGoal ); - } - } - - child.setGoals( new ArrayList( assembledGoals.values() ) ); - - child.flushGoalMap(); - } - } - - Xpp3Dom childConfiguration = (Xpp3Dom) child.getConfiguration(); - Xpp3Dom parentConfiguration = (Xpp3Dom) parent.getConfiguration(); - - childConfiguration = Xpp3Dom.mergeXpp3Dom( childConfiguration, parentConfiguration ); - - child.setConfiguration( childConfiguration ); - } - private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent ) { if ( child.getPhase() == null ) diff --git a/maven-project/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java b/maven-project/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java index cc00d4ed45..2698b49b48 100644 --- a/maven-project/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java +++ b/maven-project/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java @@ -16,10 +16,10 @@ package org.apache.maven.project.canonical; * limitations under the License. */ -import org.apache.maven.model.Goal; import org.apache.maven.model.Plugin; -import org.apache.maven.project.MavenProject; +import org.apache.maven.model.PluginExecution; import org.apache.maven.project.AbstractMavenProjectTestCase; +import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.xml.Xpp3Dom; import java.io.File; @@ -55,21 +55,21 @@ public class CanonicalProjectBuilderTest // Plugin0 [plexus] String key = "org.apache.maven.plugins:maven-plexus-plugin"; - + Plugin plugin = null; for ( Iterator it = plugins.iterator(); it.hasNext(); ) { Plugin check = (Plugin) it.next(); - + if ( key.equals( check.getKey() ) ) { plugin = check; break; } } - + assertNotNull( plugin ); - + assertEquals( "1.0", plugin.getVersion() ); Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); @@ -85,13 +85,15 @@ public class CanonicalProjectBuilderTest // Goal specific configuration // ---------------------------------------------------------------------- - List goals = plugin.getGoals(); + List executions = plugin.getExecutions(); - Goal g0 = (Goal) goals.get( 0 ); + PluginExecution execution = (PluginExecution) executions.get( 0 ); - assertEquals( "plexus:runtime", g0.getId() ); + String g0 = (String) execution.getGoals().get( 0 ); - configuration = (Xpp3Dom) g0.getConfiguration(); + assertEquals( "plexus:runtime", g0 ); + + configuration = (Xpp3Dom) execution.getConfiguration(); assertEquals( "ContinuumPro", configuration.getChild( "plexusApplicationName" ).getValue() ); diff --git a/maven-project/src/test/resources/canonical-pom.xml b/maven-project/src/test/resources/canonical-pom.xml index 020f350eb1..0fe90ddc6c 100644 --- a/maven-project/src/test/resources/canonical-pom.xml +++ b/maven-project/src/test/resources/canonical-pom.xml @@ -16,14 +16,16 @@ src/conf/plexus.properties Continuum - - - plexus:runtime + + + + plexus:runtime + ContinuumPro - - + +