You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/05/04 07:52:56 UTC
svn commit: r168082 -
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Author: brett
Date: Tue May 3 22:52:55 2005
New Revision: 168082
URL: http://svn.apache.org/viewcvs?rev=168082&view=rev
Log:
remove old style req, resp mojo support
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=168082&r1=168081&r2=168082&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Tue May 3 22:52:55 2005
@@ -55,7 +55,6 @@
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.util.CollectionUtils;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -320,8 +319,6 @@
public void executeMojo( MavenSession session, MojoDescriptor mojoDescriptor )
throws ArtifactResolutionException, PluginManagerException, MojoExecutionException
{
- MojoExecutionRequest request = null;
-
if ( mojoDescriptor.getRequiresDependencyResolution() != null )
{
@@ -364,14 +361,11 @@
plugin.setLog( session.getLog() );
- // TODO: remove
- boolean newMojoTechnique = checkMojoTechnique( plugin.getClass() );
-
- String goalId = PluginDescriptor.getGoalIdFromFullGoal( goalName );
+ String goalId = mojoDescriptor.getGoal();
// TODO: can probable refactor these a little when only the new plugin technique is in place
- Xpp3Dom dom = session.getProject().getGoalConfiguration( PluginDescriptor.getPluginArtifactIdFromGoal( goalName ),
- goalId );
+ Xpp3Dom dom = session.getProject().getGoalConfiguration(
+ PluginDescriptor.getPluginArtifactIdFromGoal( goalName ), goalId );
PlexusConfiguration pomConfiguration;
if ( dom == null )
@@ -398,22 +392,10 @@
try
{
- if ( newMojoTechnique )
- {
- Map map = getPluginConfigurationFromExpressions( plugin, mojoDescriptor, mergedConfiguration,
- expressionEvaluator );
-
- populatePluginFields( plugin, mojoDescriptor, mergedConfiguration, expressionEvaluator );
- }
- else
- {
- getLogger().warn( "WARNING: The mojo " + mojoDescriptor.getId() + " is using the OLD API" );
-
- Map map = getPluginConfigurationFromExpressions( plugin, mojoDescriptor, mergedConfiguration,
- expressionEvaluator );
+ getPluginConfigurationFromExpressions( plugin, mojoDescriptor, mergedConfiguration,
+ expressionEvaluator );
- request = createPluginRequest( pomConfiguration, map );
- }
+ populatePluginFields( plugin, mojoDescriptor, mergedConfiguration, expressionEvaluator );
}
catch ( ExpressionEvaluationException e )
{
@@ -428,14 +410,7 @@
dispatcher.dispatchStart( event, goalName );
try
{
- if ( newMojoTechnique )
- {
- plugin.execute();
- }
- else
- {
- plugin.execute( request );
- }
+ plugin.execute();
dispatcher.dispatchEnd( event, goalName );
}
@@ -545,55 +520,12 @@
return dom;
}
- /**
- * @deprecated
- */
- private static boolean checkMojoTechnique( Class aClass )
- {
- boolean newMojoTechnique = false;
- try
- {
- aClass.getDeclaredMethod( "execute", new Class[0] );
- newMojoTechnique = true;
- }
- catch ( NoSuchMethodException e )
- {
- // intentionally ignored
-
- Class superclass = aClass.getSuperclass();
- if ( superclass != AbstractMojo.class )
- {
- return checkMojoTechnique( superclass );
- }
- }
- return newMojoTechnique;
- }
-
// ----------------------------------------------------------------------
// Mojo Parameter Handling
// ----------------------------------------------------------------------
- /**
- * @param configuration
- * @param map
- * @return
- * @deprecated
- */
- private static MojoExecutionRequest createPluginRequest( PlexusConfiguration configuration, Map map )
- {
- Map parameters = new HashMap();
- PlexusConfiguration[] children = configuration.getChildren();
- for ( int i = 0; i < children.length; i++ )
- {
- PlexusConfiguration child = children[i];
- parameters.put( child.getName(), child.getValue( null ) );
- }
- map = CollectionUtils.mergeMaps( map, parameters );
- return new MojoExecutionRequest( map );
- }
-
private void populatePluginFields( Mojo plugin, MojoDescriptor mojoDescriptor, PlexusConfiguration configuration,
- ExpressionEvaluator expressionEvaluator )
+ ExpressionEvaluator expressionEvaluator )
throws PluginConfigurationException
{
ComponentConfigurator configurator = null;
@@ -621,8 +553,7 @@
catch ( ComponentLookupException e )
{
throw new PluginConfigurationException(
- "Unable to retrieve component configurator for plugin configuration",
- e );
+ "Unable to retrieve component configurator for plugin configuration", e );
}
finally
{
@@ -663,15 +594,13 @@
/**
* @deprecated [JC] in favor of what?
*/
- private Map getPluginConfigurationFromExpressions( Mojo plugin, MojoDescriptor goal,
- PlexusConfiguration mergedConfiguration,
- ExpressionEvaluator expressionEvaluator )
+ private void getPluginConfigurationFromExpressions( Mojo plugin, MojoDescriptor goal,
+ PlexusConfiguration mergedConfiguration,
+ ExpressionEvaluator expressionEvaluator )
throws ExpressionEvaluationException, PluginConfigurationException
{
List parameters = goal.getParameters();
- Map map = new HashMap();
-
for ( int i = 0; i < parameters.size(); i++ )
{
Parameter parameter = (Parameter) parameters.get( i );
@@ -785,9 +714,7 @@
createPluginParameterRequiredMessage( goal, parameter, expression ) );
}
- map.put( key, value );
}
- return map;
}
public static String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter,
@@ -821,7 +748,8 @@
artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
"maven-settings", "maven-monitor", "maven-plugin-api",
"maven-plugin-descriptor", "plexus-container-default",
- "maven-project", "plexus-container-artifact", "maven-reporting-api", "doxia-core",
+ "maven-project", "plexus-container-artifact",
+ "maven-reporting-api", "doxia-core",
"wagon-provider-api", "classworlds", "maven-plugin",
"plexus-marmalade-factory", "maven-script-marmalade",
"marmalade-core"} );
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org