jvanzyl 2004/04/05 09:58:21
Modified: maven-core/src/main/java/org/apache/maven/lifecycle
MavenLifecycleContext.java
maven-core/src/main/java/org/apache/maven/lifecycle/phase
GoalAttainmentPhase.java
maven-core/src/main/java/org/apache/maven/plugin/manager
DefaultPluginManagerManager.java
PluginManagerManager.java
Log:
o starting using the maven lifecycle context as the thread that runs from
one end of the execution process to the other. Now lifecycle phases can
communicate and plugins can communicate via the context in any part
of the lifecycle.
Revision Changes Path
1.4 +6 -1
maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/MavenLifecycleContext.java
Index: MavenLifecycleContext.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/MavenLifecycleContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MavenLifecycleContext.java 5 Apr 2004 16:28:24 -0000 1.3
+++ MavenLifecycleContext.java 5 Apr 2004 16:58:21 -0000 1.4
@@ -35,6 +35,11 @@
return project;
}
+ public void setGoal( String goal )
+ {
+ this.goal = goal;
+ }
+
public String getGoal()
{
return goal;
1.3 +2 -2
maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalAttainmentPhase.java
Index: GoalAttainmentPhase.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/phase/GoalAttainmentPhase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GoalAttainmentPhase.java 5 Apr 2004 16:28:24 -0000 1.2
+++ GoalAttainmentPhase.java 5 Apr 2004 16:58:21 -0000 1.3
@@ -17,7 +17,7 @@
{
PluginManagerManager pmm = (PluginManagerManager)
context.getContainer().lookup( PluginManagerManager.ROLE );
- PluginExecutionResponse response = pmm.attainGoal( context.getProject(),
context.getGoal() );
+ PluginExecutionResponse response = pmm.attainGoal( context );
if ( response.exceptionOccurred() )
{
1.9 +14 -6
maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/DefaultPluginManagerManager.java
Index: DefaultPluginManagerManager.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/DefaultPluginManagerManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultPluginManagerManager.java 4 Apr 2004 17:23:44 -0000 1.8
+++ DefaultPluginManagerManager.java 5 Apr 2004 16:58:21 -0000 1.9
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-import org.apache.maven.GoalNotFoundException;
+import org.apache.maven.lifecycle.MavenLifecycleContext;
import org.apache.maven.plugin.PluginExecutionRequest;
import org.apache.maven.plugin.PluginExecutionResponse;
import org.apache.maven.plugin.descriptor.GoalDescriptor;
@@ -30,9 +30,9 @@
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.dag.CycleDetectedException;
import org.codehaus.plexus.util.dag.DAG;
import org.codehaus.plexus.util.dag.TopologicalSorter;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
import java.util.HashMap;
import java.util.Iterator;
@@ -90,15 +90,17 @@
// Plugin execution
// ----------------------------------------------------------------------
- public PluginExecutionResponse attainGoal( MavenProject project, String goal )
+ public PluginExecutionResponse attainGoal( MavenLifecycleContext context )
{
+ String goal = context.getGoal();
+
PluginManager pluginManager = (PluginManager) pluginManagers.get( "plexus"
);
PluginExecutionResponse response = null;
if ( dag.getChildLabels( goal ).size() == 0 && dag.getParentLabels( goal
).size() == 0 )
{
- response = attainGoal( pluginManager, project, goal );
+ response = attainGoal( pluginManager, context );
}
else
{
@@ -110,7 +112,9 @@
{
String goalName = (String) goals.get( j );
- response = attainGoal( pluginManager, project, goalName );
+ context.setGoal( goalName );
+
+ response = attainGoal( pluginManager, context );
if ( response.exceptionOccurred() )
{
@@ -122,8 +126,12 @@
return response;
}
- private PluginExecutionResponse attainGoal( PluginManager pluginManager,
MavenProject project, String goal )
+ private PluginExecutionResponse attainGoal( PluginManager pluginManager,
MavenLifecycleContext context )
{
+ String goal = context.getGoal();
+
+ MavenProject project = context.getProject();
+
System.out.println( "[" + goal + "]" );
GoalDescriptor goalDescriptor = getGoalDescriptor( goal );
1.7 +5 -6
maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/PluginManagerManager.java
Index: PluginManagerManager.java
===================================================================
RCS file:
/home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/manager/PluginManagerManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PluginManagerManager.java 4 Apr 2004 17:23:44 -0000 1.6
+++ PluginManagerManager.java 5 Apr 2004 16:58:21 -0000 1.7
@@ -16,12 +16,11 @@
* limitations under the License.
*/
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.plugin.descriptor.GoalDescriptor;
+import org.apache.maven.lifecycle.MavenLifecycleContext;
import org.apache.maven.plugin.PluginExecutionResponse;
-import org.apache.maven.project.MavenProject;
+import org.apache.maven.plugin.descriptor.GoalDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import java.util.List;
import java.util.Map;
/**
@@ -39,7 +38,7 @@
// Plugin execution
// ----------------------------------------------------------------------
- PluginExecutionResponse attainGoal( MavenProject project, String goal );
+ PluginExecutionResponse attainGoal( MavenLifecycleContext contexta );
// ----------------------------------------------------------------------
// Plugin processing
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]