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
This commit is contained in:
Brett Leslie Porter 2005-10-03 13:10:39 +00:00
parent b4d541a6cf
commit 85fe459856
6 changed files with 19 additions and 149 deletions

View File

@ -27,7 +27,6 @@ import org.apache.maven.execution.ReactorManager;
import org.apache.maven.extension.ExtensionManager; import org.apache.maven.extension.ExtensionManager;
import org.apache.maven.lifecycle.mapping.LifecycleMapping; import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.model.Extension; import org.apache.maven.model.Extension;
import org.apache.maven.model.Goal;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution; import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.PluginManagement; 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 // 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() ) if ( plugin.isInheritanceApplied() || pluginDescriptor.isInheritedByDefault() )
{ {
bindGoalMapToLifecycle( pluginDescriptor, plugin.getGoalsAsMap(), phaseMap, settings );
List executions = plugin.getExecutions(); List executions = plugin.getExecutions();
if ( executions != null ) if ( executions != null )
@ -1074,33 +1071,6 @@ public class DefaultLifecycleExecutor
return pluginDescriptor; 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, private void bindExecutionToLifecycle( PluginDescriptor pluginDescriptor, Map phaseMap, PluginExecution execution,
Settings settings ) Settings settings )
throws LifecycleExecutionException throws LifecycleExecutionException

View File

@ -2516,22 +2516,6 @@
</field> </field>
</fields> </fields>
</class> </class>
<!-- TODO: deprecated -->
<class>
<name>Goal</name>
<version>4.0.0</version>
<fields>
<field>
<name>id</name>
<version>4.0.0</version>
<type>String</type>
</field>
<field>
<name>configuration</name>
<type>DOM</type>
</field>
</fields>
</class>
<class> <class>
<name>DependencyManagement</name> <name>DependencyManagement</name>
<version>4.0.0</version> <version>4.0.0</version>

View File

@ -30,7 +30,6 @@ import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement; import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Developer; import org.apache.maven.model.Developer;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Goal;
import org.apache.maven.model.IssueManagement; import org.apache.maven.model.IssueManagement;
import org.apache.maven.model.License; import org.apache.maven.model.License;
import org.apache.maven.model.MailingList; import org.apache.maven.model.MailingList;
@ -1234,21 +1233,6 @@ public class MavenProject
{ {
dom = (Xpp3Dom) plugin.getConfiguration(); 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 ) if ( executionId != null )
{ {
PluginExecution execution = (PluginExecution) plugin.getExecutionsAsMap().get( executionId ); PluginExecution execution = (PluginExecution) plugin.getExecutionsAsMap().get( executionId );

View File

@ -26,7 +26,6 @@ import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.DistributionManagement; import org.apache.maven.model.DistributionManagement;
import org.apache.maven.model.Exclusion; import org.apache.maven.model.Exclusion;
import org.apache.maven.model.Extension; import org.apache.maven.model.Extension;
import org.apache.maven.model.Goal;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.model.Parent; import org.apache.maven.model.Parent;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
@ -199,9 +198,6 @@ public final class ModelUtils
child.setVersion( parent.getVersion() ); child.setVersion( parent.getVersion() );
} }
// merge the lists of goals that are not attached to an <execution/>
mergeGoalContainerDefinitions( child, parent );
// from here to the end of the method is dealing with merging of the <executions/> section. // from here to the end of the method is dealing with merging of the <executions/> section.
String parentInherited = parent.getInherited(); 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 ) private static void mergePluginExecutionDefinitions( PluginExecution child, PluginExecution parent )
{ {
if ( child.getPhase() == null ) if ( child.getPhase() == null )

View File

@ -16,10 +16,10 @@ package org.apache.maven.project.canonical;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.model.Goal;
import org.apache.maven.model.Plugin; 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.AbstractMavenProjectTestCase;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.File; import java.io.File;
@ -55,21 +55,21 @@ public class CanonicalProjectBuilderTest
// Plugin0 [plexus] // Plugin0 [plexus]
String key = "org.apache.maven.plugins:maven-plexus-plugin"; String key = "org.apache.maven.plugins:maven-plexus-plugin";
Plugin plugin = null; Plugin plugin = null;
for ( Iterator it = plugins.iterator(); it.hasNext(); ) for ( Iterator it = plugins.iterator(); it.hasNext(); )
{ {
Plugin check = (Plugin) it.next(); Plugin check = (Plugin) it.next();
if ( key.equals( check.getKey() ) ) if ( key.equals( check.getKey() ) )
{ {
plugin = check; plugin = check;
break; break;
} }
} }
assertNotNull( plugin ); assertNotNull( plugin );
assertEquals( "1.0", plugin.getVersion() ); assertEquals( "1.0", plugin.getVersion() );
Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration();
@ -85,13 +85,15 @@ public class CanonicalProjectBuilderTest
// Goal specific configuration // 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() ); assertEquals( "ContinuumPro", configuration.getChild( "plexusApplicationName" ).getValue() );

View File

@ -16,14 +16,16 @@
<plexusConfigurationPropertiesFile>src/conf/plexus.properties</plexusConfigurationPropertiesFile> <plexusConfigurationPropertiesFile>src/conf/plexus.properties</plexusConfigurationPropertiesFile>
<plexusApplicationName>Continuum</plexusApplicationName> <plexusApplicationName>Continuum</plexusApplicationName>
</configuration> </configuration>
<goals> <executions>
<goal> <execution>
<id>plexus:runtime</id> <goals>
<goal>plexus:runtime</goal>
</goals>
<configuration> <configuration>
<plexusApplicationName>ContinuumPro</plexusApplicationName> <plexusApplicationName>ContinuumPro</plexusApplicationName>
</configuration> </configuration>
</goal> </execution>
</goals> </executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>