You are viewing a plain text version of this content. The canonical link for it is here.
Posted to m2-dev@maven.apache.org by br...@apache.org on 2005/03/21 02:02:36 UTC
cvs commit: maven-components/maven-plugin/src/main/java/org/apache/maven/plugin AbstractPlugin.java Plugin.java
brett 2005/03/20 17:02:36
Modified: maven-core/src/main/java/org/apache/maven/plugin
DefaultPluginManager.java
maven-plugin/src/main/java/org/apache/maven/plugin
AbstractPlugin.java Plugin.java
Log:
setup a simple, backwards compatible mechanism to start implementing the new plugin instantiation
Revision Changes Path
1.60 +22 -13 maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- DefaultPluginManager.java 21 Mar 2005 00:07:39 -0000 1.59
+++ DefaultPluginManager.java 21 Mar 2005 01:02:36 -0000 1.60
@@ -329,9 +329,7 @@
throw new PluginExecutionException( "Unable to execute goal: " + goalName, e );
}
- PluginExecutionRequest request;
-
- PluginExecutionResponse response;
+ PluginExecutionRequest request = null;
MojoDescriptor mojoDescriptor = getMojoDescriptor( goalName );
if ( mojoDescriptor == null )
@@ -374,15 +372,6 @@
throw new PluginExecutionException( "Unable to resolve required dependencies for goal", e );
}
- try
- {
- request = new PluginExecutionRequest( createParameters( mojoDescriptor, session ) );
- }
- catch ( PluginConfigurationException e )
- {
- throw new PluginExecutionException( "Error configuring plugin for execution.", e );
- }
-
Plugin plugin = null;
try
@@ -391,6 +380,15 @@
plugin.setLog( session.getLog() );
+ if ( plugin.supportsNewMojoParadigm() )
+ {
+ // TODO: construct request
+ }
+ else
+ {
+ request = new PluginExecutionRequest( createParameters( mojoDescriptor, session ) );
+ }
+
// !! This is ripe for refactoring to an aspect.
// Event monitoring.
String event = MavenEvents.MOJO_EXECUTION;
@@ -399,7 +397,14 @@
dispatcher.dispatchStart( event, goalName );
try
{
- plugin.execute( request );
+ if ( plugin.supportsNewMojoParadigm() )
+ {
+ plugin.execute();
+ }
+ else
+ {
+ plugin.execute( request );
+ }
dispatcher.dispatchEnd( event, goalName );
}
@@ -411,6 +416,10 @@
// End event monitoring.
}
+ catch ( PluginConfigurationException e )
+ {
+ throw new PluginExecutionException( "Error configuring plugin for execution.", e );
+ }
catch ( ComponentLookupException e )
{
throw new PluginExecutionException( "Error looking up plugin: ", e );
1.5 +16 -3 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java
Index: AbstractPlugin.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/AbstractPlugin.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractPlugin.java 21 Mar 2005 00:07:39 -0000 1.4
+++ AbstractPlugin.java 21 Mar 2005 01:02:36 -0000 1.5
@@ -29,6 +29,7 @@
/**
* Default behaviour to mimic old behaviour.
+ *
* @deprecated
*/
public void execute( PluginExecutionRequest request )
@@ -64,9 +65,9 @@
public Log getLog()
{
- synchronized(this)
+ synchronized ( this )
{
- if(log == null)
+ if ( log == null )
{
log = new SystemStreamLog();
}
@@ -74,4 +75,16 @@
return log;
}
+
+ public void execute()
+ throws PluginExecutionException
+ {
+ if ( supportsNewMojoParadigm() )
+ throw new PluginExecutionException( "You must override execute() if you implement the new paradigm" );
+ }
+
+ public boolean supportsNewMojoParadigm()
+ {
+ return false;
+ }
}
1.6 +8 -1 maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java
Index: Plugin.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin/src/main/java/org/apache/maven/plugin/Plugin.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Plugin.java 21 Mar 2005 00:07:39 -0000 1.5
+++ Plugin.java 21 Mar 2005 01:02:36 -0000 1.6
@@ -26,9 +26,16 @@
{
String ROLE = Plugin.class.getName();
+ void execute()
+ throws PluginExecutionException;
+
+ /** @deprecated */
void execute( PluginExecutionRequest request )
throws PluginExecutionException;
// TODO: not sure about this here, and may want a getLog on here as well/instead
void setLog( Log log );
+
+ /** @deprecated */
+ boolean supportsNewMojoParadigm();
}