You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/04/11 23:41:33 UTC

svn commit: r933000 - in /maven/maven-3/trunk/maven-core/src: main/java/org/apache/maven/ main/java/org/apache/maven/execution/ main/java/org/apache/maven/lifecycle/ main/java/org/apache/maven/lifecycle/internal/ test/java/org/apache/maven/lifecycle/in...

Author: bentmann
Date: Sun Apr 11 21:41:33 2010
New Revision: 933000

URL: http://svn.apache.org/viewvc?rev=933000&view=rev
Log:
o Refactored execution event firing

Added:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java
      - copied, changed from r932461, maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java   (with props)
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java   (with props)
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java   (with props)
Removed:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java
Modified:
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java
    maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
    maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Sun Apr 11 21:41:33 2010
@@ -29,10 +29,8 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.execution.DefaultLifecycleEvent;
 import org.apache.maven.execution.DefaultMavenExecutionResult;
 import org.apache.maven.execution.ExecutionEvent;
-import org.apache.maven.execution.ExecutionListener;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionRequestPopulationException;
 import org.apache.maven.execution.MavenExecutionRequestPopulator;
@@ -40,6 +38,7 @@ import org.apache.maven.execution.MavenE
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ProjectDependencyGraph;
 import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
 import org.apache.maven.lifecycle.internal.LifecycleWeaveBuilder;
 import org.apache.maven.model.building.ModelProblem;
 import org.apache.maven.model.building.ModelSource;
@@ -84,17 +83,8 @@ public class DefaultMaven
     @Requirement
     MavenExecutionRequestPopulator populator;
 
-    private void fireEvent( MavenSession session, ExecutionEventCatapult catapult )
-    {
-        ExecutionListener listener = session.getRequest().getExecutionListener();
-
-        if ( listener != null )
-        {
-            ExecutionEvent event = new DefaultLifecycleEvent( session, null );
-
-            catapult.fire( listener, event );
-        }
-    }
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
 
     public MavenExecutionResult execute( MavenExecutionRequest request )
     {
@@ -162,7 +152,7 @@ public class DefaultMaven
             return processResult( result, e );
         }
 
-        fireEvent( session, ExecutionEventCatapult.PROJECT_DISCOVERY_STARTED );
+        eventCatapult.fire( ExecutionEvent.Type.ProjectDiscoveryStarted, session, null );
 
         //TODO: optimize for the single project or no project
         

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java Sun Apr 11 21:41:33 2010
@@ -31,6 +31,37 @@ public interface ExecutionEvent
 {
 
     /**
+     * The possible types of execution events.
+     */
+    enum Type
+    {
+        ProjectDiscoveryStarted,
+        SessionStarted,
+        SessionEnded,
+        ProjectSkipped,
+        ProjectStarted,
+        ProjectSucceeded,
+        ProjectFailed,
+        MojoSkipped,
+        MojoStarted,
+        MojoSucceeded,
+        MojoFailed,
+        ForkStarted,
+        ForkSucceeded,
+        ForkFailed,
+        ForkedProjectStarted,
+        ForkedProjectSucceeded,
+        ForkedProjectFailed,
+    }
+
+    /**
+     * Gets the type of the event.
+     * 
+     * @return The type of the event, never {@code null}.
+     */
+    Type getType();
+
+    /**
      * Gets the session from which this event originates.
      * 
      * @return The current session, never {@code null}.

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Sun Apr 11 21:41:33 2010
@@ -14,14 +14,13 @@
  */
 package org.apache.maven.lifecycle;
 
-import org.apache.maven.execution.DefaultLifecycleEvent;
 import org.apache.maven.execution.ExecutionEvent;
-import org.apache.maven.execution.ExecutionListener;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.internal.BuildListCalculator;
 import org.apache.maven.lifecycle.internal.ConcurrencyDependencyGraph;
+import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
 import org.apache.maven.lifecycle.internal.LifecycleDebugLogger;
 import org.apache.maven.lifecycle.internal.LifecycleExecutionPlanCalculator;
 import org.apache.maven.lifecycle.internal.LifecycleModuleBuilder;
@@ -38,7 +37,6 @@ import org.apache.maven.lifecycle.intern
 import org.apache.maven.lifecycle.internal.ThreadConfigurationService;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.InvalidPluginDescriptorException;
-import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.MojoNotFoundException;
 import org.apache.maven.plugin.PluginDescriptorParsingException;
 import org.apache.maven.plugin.PluginManagerException;
@@ -68,6 +66,10 @@ import java.util.concurrent.ExecutorServ
 public class DefaultLifecycleExecutor
     implements LifecycleExecutor
 {
+
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
+
     @Requirement
     private LifeCyclePluginAnalyzer lifeCyclePluginAnalyzer;
 
@@ -107,7 +109,7 @@ public class DefaultLifecycleExecutor
 
     public void execute( MavenSession session )
     {
-        fireEvent( session, null, LifecycleEventCatapult.SESSION_STARTED );
+        eventCatapult.fire( ExecutionEvent.Type.SessionStarted, session, null );
 
         MavenExecutionResult result = session.getResult();
 
@@ -200,8 +202,7 @@ public class DefaultLifecycleExecutor
             result.addException( e );
         }
 
-        fireEvent( session, null, LifecycleEventCatapult.SESSION_ENDED );
-
+        eventCatapult.fire( ExecutionEvent.Type.SessionEnded, session, null );
     }
 
     private void singleThreadedBuild( MavenSession session, ReactorContext callableContext,
@@ -230,18 +231,6 @@ public class DefaultLifecycleExecutor
         }
     }
 
-    public static void fireEvent( MavenSession session, MojoExecution mojoExecution, LifecycleEventCatapult catapult )
-    {
-        ExecutionListener listener = session.getRequest().getExecutionListener();
-        if ( listener != null )
-        {
-            ExecutionEvent event = new DefaultLifecycleEvent( session, mojoExecution );
-
-            catapult.fire( listener, event );
-        }
-    }
-
-
     /**
      * * CRUFT GOES BELOW HERE ***
      */

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/BuilderCommon.java Sun Apr 11 21:41:33 2010
@@ -15,6 +15,7 @@
 package org.apache.maven.lifecycle.internal;
 
 import org.apache.maven.execution.BuildFailure;
+import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.*;
@@ -45,6 +46,9 @@ public class BuilderCommon
     @Requirement
     private LifecycleDependencyResolver lifecycleDependencyResolver;
 
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
+
     @SuppressWarnings({"UnusedDeclaration"})
     public BuilderCommon()
     {
@@ -79,7 +83,7 @@ public class BuilderCommon
     }
 
 
-    public static void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession,
+    public void handleBuildError( final ReactorContext buildContext, final MavenSession rootSession,
                                          final MavenProject mavenProject, final Exception e, final long buildStartTime )
     {
         buildContext.getResult().addException( e );
@@ -88,7 +92,7 @@ public class BuilderCommon
 
         buildContext.getResult().addBuildSummary( new BuildFailure( mavenProject, buildEndTime - buildStartTime, e ) );
 
-        DefaultLifecycleExecutor.fireEvent( rootSession, null, LifecycleEventCatapult.PROJECT_FAILED );
+        eventCatapult.fire( ExecutionEvent.Type.ProjectFailed, rootSession, null );
 
         if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( rootSession.getReactorFailureBehavior() ) )
         {

Copied: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java (from r932461, maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java)
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java?p2=maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java&p1=maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java&r1=932461&r2=933000&rev=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEvent.java Sun Apr 11 21:41:33 2010
@@ -1,4 +1,4 @@
-package org.apache.maven.execution;
+package org.apache.maven.lifecycle.internal;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,6 +19,8 @@ package org.apache.maven.execution;
  * under the License.
  */
 
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.project.MavenProject;
 
@@ -27,20 +29,28 @@ import org.apache.maven.project.MavenPro
  * 
  * @author Benjamin Bentmann
  */
-public class DefaultLifecycleEvent
+class DefaultExecutionEvent
     implements ExecutionEvent
 {
 
+    private final Type type;
+
     private final MavenSession session;
 
     private final MojoExecution mojoExecution;
 
-    public DefaultLifecycleEvent( MavenSession session, MojoExecution mojoExecution )
+    public DefaultExecutionEvent( Type type, MavenSession session, MojoExecution mojoExecution )
     {
+        this.type = type;
         this.session = session;
         this.mojoExecution = mojoExecution;
     }
 
+    public Type getType()
+    {
+        return type;
+    }
+
     public MavenSession getSession()
     {
         return session;

Added: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java?rev=933000&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java (added)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java Sun Apr 11 21:41:33 2010
@@ -0,0 +1,113 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.ExecutionListener;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+import org.codehaus.plexus.component.annotations.Component;
+
+/**
+ * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility class that is only public
+ * for technical reasons, it is not part of the public API. In particular, this class can be changed or deleted without
+ * prior notice.
+ * 
+ * @author Benjamin Bentmann
+ */
+@Component( role = ExecutionEventCatapult.class )
+public class DefaultExecutionEventCatapult
+    implements ExecutionEventCatapult
+{
+
+    public void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution )
+    {
+        ExecutionListener listener = session.getRequest().getExecutionListener();
+
+        if ( listener != null )
+        {
+            ExecutionEvent event = new DefaultExecutionEvent( eventType, session, mojoExecution );
+
+            switch ( eventType )
+            {
+                case ProjectDiscoveryStarted:
+                    listener.projectDiscoveryStarted( event );
+                    break;
+
+                case SessionStarted:
+                    listener.sessionStarted( event );
+                    break;
+                case SessionEnded:
+                    listener.sessionEnded( event );
+                    break;
+
+                case ProjectSkipped:
+                    listener.projectSkipped( event );
+                    break;
+                case ProjectStarted:
+                    listener.projectStarted( event );
+                    break;
+                case ProjectSucceeded:
+                    listener.projectSucceeded( event );
+                    break;
+                case ProjectFailed:
+                    listener.projectFailed( event );
+                    break;
+
+                case MojoSkipped:
+                    listener.mojoSkipped( event );
+                    break;
+                case MojoStarted:
+                    listener.mojoStarted( event );
+                    break;
+                case MojoSucceeded:
+                    listener.mojoSucceeded( event );
+                    break;
+                case MojoFailed:
+                    listener.mojoFailed( event );
+                    break;
+
+                case ForkStarted:
+                    listener.forkStarted( event );
+                    break;
+                case ForkSucceeded:
+                    listener.forkSucceeded( event );
+                    break;
+                case ForkFailed:
+                    listener.forkFailed( event );
+                    break;
+
+                case ForkedProjectStarted:
+                    listener.forkedProjectStarted( event );
+                    break;
+                case ForkedProjectSucceeded:
+                    listener.forkedProjectSucceeded( event );
+                    break;
+                case ForkedProjectFailed:
+                    listener.forkedProjectFailed( event );
+                    break;
+
+                default:
+                    throw new IllegalStateException( "Unknown execution event type " + eventType );
+            }
+        }
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultExecutionEventCatapult.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java?rev=933000&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java (added)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java Sun Apr 11 21:41:33 2010
@@ -0,0 +1,38 @@
+package org.apache.maven.lifecycle.internal;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.plugin.MojoExecution;
+
+/**
+ * Assists in firing execution events. <strong>Warning:</strong> This is an internal utility interface that is only
+ * public for technical reasons, it is not part of the public API. In particular, this interface can be changed or
+ * deleted without prior notice.
+ * 
+ * @author Benjamin Bentmann
+ */
+public interface ExecutionEventCatapult
+{
+
+    void fire( ExecutionEvent.Type eventType, MavenSession session, MojoExecution mojoExecution );
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/ExecutionEventCatapult.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleModuleBuilder.java Sun Apr 11 21:41:33 2010
@@ -16,9 +16,8 @@
 package org.apache.maven.lifecycle.internal;
 
 import org.apache.maven.execution.BuildSuccess;
+import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.DefaultLifecycleExecutor;
-import org.apache.maven.lifecycle.LifecycleEventCatapult;
 import org.apache.maven.lifecycle.MavenExecutionPlan;
 import org.apache.maven.project.MavenProject;
 import org.codehaus.plexus.component.annotations.Component;
@@ -36,12 +35,16 @@ import org.codehaus.plexus.component.ann
 @Component(role = LifecycleModuleBuilder.class)
 public class LifecycleModuleBuilder
 {
+
     @Requirement
     private MojoExecutor mojoExecutor;
 
     @Requirement
     private BuilderCommon builderCommon;
 
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
+
     public void buildProject( MavenSession session, ReactorContext reactorContext, MavenProject currentProject,
                               TaskSegment taskSegment )
     {
@@ -62,11 +65,11 @@ public class LifecycleModuleBuilder
 
             if ( reactorContext.getReactorBuildStatus().isHaltedOrBlacklisted( currentProject ) )
             {
-                DefaultLifecycleExecutor.fireEvent( session, null, LifecycleEventCatapult.PROJECT_SKIPPED );
+                eventCatapult.fire( ExecutionEvent.Type.ProjectSkipped, session, null );
                 return;
             }
 
-            DefaultLifecycleExecutor.fireEvent( session, null, LifecycleEventCatapult.PROJECT_STARTED );
+            eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, session, null );
 
             BuilderCommon.attachToThread( currentProject );
             MavenExecutionPlan executionPlan = builderCommon.resolveBuildPlan( session, currentProject, taskSegment );
@@ -80,11 +83,11 @@ public class LifecycleModuleBuilder
             reactorContext.getResult().addBuildSummary(
                 new BuildSuccess( currentProject, buildEndTime - buildStartTime ) );
 
-            DefaultLifecycleExecutor.fireEvent( session, null, LifecycleEventCatapult.PROJECT_SUCCEEDED );
+            eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, session, null );
         }
         catch ( Exception e )
         {
-            BuilderCommon.handleBuildError( reactorContext, rootSession, currentProject, e, buildStartTime );
+            builderCommon.handleBuildError( reactorContext, rootSession, currentProject, e, buildStartTime );
         }
         finally
         {

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilder.java Sun Apr 11 21:41:33 2010
@@ -15,6 +15,7 @@
 package org.apache.maven.lifecycle.internal;
 
 import org.apache.maven.execution.BuildSuccess;
+import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.lifecycle.*;
@@ -50,6 +51,7 @@ import java.util.concurrent.Future;
 @Component(role = LifecycleWeaveBuilder.class)
 public class LifecycleWeaveBuilder
 {
+
     @Requirement
     private MojoExecutor mojoExecutor;
 
@@ -62,6 +64,8 @@ public class LifecycleWeaveBuilder
     @Requirement
     private LifecycleDependencyResolver lifecycleDependencyResolver;
 
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
 
     private final Map<MavenProject, MavenExecutionPlan> executionPlans =
         Collections.synchronizedMap( new HashMap<MavenProject, MavenExecutionPlan>() );
@@ -73,12 +77,13 @@ public class LifecycleWeaveBuilder
     }
 
     public LifecycleWeaveBuilder( MojoExecutor mojoExecutor, BuilderCommon builderCommon, Logger logger,
-                                  LifecycleDependencyResolver lifecycleDependencyResolver )
+                                  LifecycleDependencyResolver lifecycleDependencyResolver, ExecutionEventCatapult eventCatapult )
     {
         this.mojoExecutor = mojoExecutor;
         this.builderCommon = builderCommon;
         this.logger = logger;
         this.lifecycleDependencyResolver = lifecycleDependencyResolver;
+        this.eventCatapult = eventCatapult;
     }
 
     public void build( ProjectBuildList projectBuilds, ReactorContext buildContext, List<TaskSegment> taskSegments,
@@ -157,13 +162,11 @@ public class LifecycleWeaveBuilder
 
                 if ( reactorBuildStatus.isHaltedOrBlacklisted( projectBuild.getProject() ) )
                 {
-                    DefaultLifecycleExecutor.fireEvent( projectBuild.getSession(), null,
-                                                        LifecycleEventCatapult.PROJECT_SKIPPED );
+                    eventCatapult.fire( ExecutionEvent.Type.ProjectSkipped, projectBuild.getSession(), null );
                     return null;
                 }
 
-                DefaultLifecycleExecutor.fireEvent( projectBuild.getSession(), null,
-                                                    LifecycleEventCatapult.PROJECT_STARTED );
+                eventCatapult.fire( ExecutionEvent.Type.ProjectStarted, projectBuild.getSession(), null );
 
                 boolean packagePhaseSeen = false;
                 boolean runBAbyRun = false;
@@ -238,13 +241,11 @@ public class LifecycleWeaveBuilder
                     final BuildSuccess summary =
                         new BuildSuccess( projectBuild.getProject(), wallClockTime ); // - waitingTime 
                     reactorContext.getResult().addBuildSummary( summary );
-                    DefaultLifecycleExecutor.fireEvent( projectBuild.getSession(), null,
-                                                        LifecycleEventCatapult.PROJECT_SUCCEEDED );
-
+                    eventCatapult.fire( ExecutionEvent.Type.ProjectSucceeded, projectBuild.getSession(), null );
                 }
                 catch ( Exception e )
                 {
-                    BuilderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getProject(), e,
+                    builderCommon.handleBuildError( reactorContext, rootSession, projectBuild.getProject(), e,
                                                     buildStartTime );
                 }
                 finally

Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java Sun Apr 11 21:41:33 2010
@@ -16,9 +16,8 @@ package org.apache.maven.lifecycle.inter
 
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.resolver.filter.CumulativeScopeArtifactFilter;
+import org.apache.maven.execution.ExecutionEvent;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.DefaultLifecycleExecutor;
-import org.apache.maven.lifecycle.LifecycleEventCatapult;
 import org.apache.maven.lifecycle.LifecycleExecutionException;
 import org.apache.maven.lifecycle.MissingProjectException;
 import org.apache.maven.plugin.*;
@@ -52,6 +51,9 @@ public class MojoExecutor
     @Requirement
     private LifecycleDependencyResolver lifeCycleDependencyResolver;
 
+    @Requirement
+    private ExecutionEventCatapult eventCatapult;
+
     public MojoExecutor()
     {
     }
@@ -103,7 +105,7 @@ public class MojoExecutor
             }
             else
             {
-                DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.MOJO_SKIPPED );
+                eventCatapult.fire( ExecutionEvent.Type.MojoSkipped, session, mojoExecution );
 
                 return;
             }
@@ -114,7 +116,7 @@ public class MojoExecutor
         List<MavenProject> forkedProjects =
             executeForkedExecutions( mojoExecution, session, projectIndex, dependencyContext );
 
-        DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.MOJO_STARTED );
+        eventCatapult.fire( ExecutionEvent.Type.MojoStarted, session, mojoExecution );
 
         ArtifactFilter artifactFilter = getArtifactFilter( mojoDescriptor );
         List<MavenProject> resolvedProjects =
@@ -148,11 +150,11 @@ public class MojoExecutor
                 throw new LifecycleExecutionException( mojoExecution, session.getCurrentProject(), e );
             }
 
-            DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.MOJO_SUCCEEDED );
+            eventCatapult.fire( ExecutionEvent.Type.MojoSucceeded, session, mojoExecution );
         }
         catch ( LifecycleExecutionException e )
         {
-            DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.MOJO_FAILED );
+            eventCatapult.fire( ExecutionEvent.Type.MojoFailed, session, mojoExecution );
 
             throw e;
         }
@@ -200,7 +202,7 @@ public class MojoExecutor
 
         if ( !forkedExecutions.isEmpty() )
         {
-            DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.FORK_STARTED );
+            eventCatapult.fire( ExecutionEvent.Type.ForkStarted, session, mojoExecution );
 
             MavenProject project = session.getCurrentProject();
 
@@ -228,18 +230,15 @@ public class MojoExecutor
                         session.getProjects().set( index, executedProject );
                         projectIndex.getProjects().put( fork.getKey(), executedProject );
 
-                        DefaultLifecycleExecutor.fireEvent( session, mojoExecution,
-                                                            LifecycleEventCatapult.FORKED_PROJECT_STARTED );
+                        eventCatapult.fire( ExecutionEvent.Type.ForkedProjectStarted, session, mojoExecution );
 
                         execute( session, fork.getValue(), projectIndex, dependencyContext );
 
-                        DefaultLifecycleExecutor.fireEvent( session, mojoExecution,
-                                                            LifecycleEventCatapult.FORKED_PROJECT_SUCCEEDED );
+                        eventCatapult.fire( ExecutionEvent.Type.ForkedProjectSucceeded, session, mojoExecution );
                     }
                     catch ( LifecycleExecutionException e )
                     {
-                        DefaultLifecycleExecutor.fireEvent( session, mojoExecution,
-                                                            LifecycleEventCatapult.FORKED_PROJECT_FAILED );
+                        eventCatapult.fire( ExecutionEvent.Type.ForkedProjectFailed, session, mojoExecution );
 
                         throw e;
                     }
@@ -251,11 +250,11 @@ public class MojoExecutor
                     }
                 }
 
-                DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.FORK_SUCCEEDED );
+                eventCatapult.fire( ExecutionEvent.Type.ForkSucceeded, session, mojoExecution );
             }
             catch ( LifecycleExecutionException e )
             {
-                DefaultLifecycleExecutor.fireEvent( session, mojoExecution, LifecycleEventCatapult.FORK_FAILED );
+                eventCatapult.fire( ExecutionEvent.Type.ForkFailed, session, mojoExecution );
 
                 throw e;
             }

Modified: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java?rev=933000&r1=932999&r2=933000&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java (original)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleWeaveBuilderTest.java Sun Apr 11 21:41:33 2010
@@ -21,6 +21,7 @@ import org.apache.maven.execution.MavenS
 import org.apache.maven.lifecycle.LifecycleNotFoundException;
 import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
 import org.apache.maven.lifecycle.internal.stub.CompletionServiceStub;
+import org.apache.maven.lifecycle.internal.stub.ExecutionEventCatapultStub;
 import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
 import org.apache.maven.lifecycle.internal.stub.LoggerStub;
 import org.apache.maven.lifecycle.internal.stub.MojoExecutorStub;
@@ -121,8 +122,8 @@ public class LifecycleWeaveBuilderTest
         final LoggerStub loggerStub = new LoggerStub();
         final LifecycleDependencyResolver lifecycleDependencyResolver =
             new LifecycleDependencyResolver( new ProjectDependenciesResolverStub(), loggerStub );
-        return new LifecycleWeaveBuilder( mojoExecutor, builderCommon, loggerStub, lifecycleDependencyResolver );
-
+        return new LifecycleWeaveBuilder( mojoExecutor, builderCommon, loggerStub, lifecycleDependencyResolver,
+                                          new ExecutionEventCatapultStub() );
     }
 
     private BuilderCommon getBuilderCommon()

Added: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java?rev=933000&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java (added)
+++ maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java Sun Apr 11 21:41:33 2010
@@ -0,0 +1,38 @@
+package org.apache.maven.lifecycle.internal.stub;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ExecutionEvent.Type;
+import org.apache.maven.lifecycle.internal.ExecutionEventCatapult;
+import org.apache.maven.plugin.MojoExecution;
+
+/**
+ * @author Benjamin Bentmann
+ */
+public class ExecutionEventCatapultStub
+    implements ExecutionEventCatapult
+{
+
+    public void fire( Type eventType, MavenSession session, MojoExecution mojoExecution )
+    {
+    }
+
+}

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/maven-3/trunk/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ExecutionEventCatapultStub.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision