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 2009/08/25 09:46:22 UTC
svn commit: r807507 - in /maven/components/trunk:
maven-core/src/main/java/org/apache/maven/
maven-core/src/main/java/org/apache/maven/execution/
maven-core/src/main/java/org/apache/maven/lifecycle/
maven-embedder/src/main/java/org/apache/maven/cli/
Author: bentmann
Date: Tue Aug 25 07:46:21 2009
New Revision: 807507
URL: http://svn.apache.org/viewvc?rev=807507&view=rev
Log:
o Generalized lifecycle listener
Added:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java (with props)
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java
- copied, changed from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleEvent.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java
- copied, changed from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEvent.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java
- copied, changed from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleListener.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractExecutionListener.java
- copied, changed from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractLifecycleListener.java
maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java
- copied, changed from r807111, maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/LifecycleEventLogger.java
Removed:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractLifecycleListener.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleEvent.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEvent.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleListener.java
maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/LifecycleEventLogger.java
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java
maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue Aug 25 07:46:21 2009
@@ -30,8 +30,11 @@
import org.apache.maven.exception.DefaultExceptionHandler;
import org.apache.maven.exception.ExceptionHandler;
import org.apache.maven.exception.ExceptionSummary;
+import org.apache.maven.execution.DefaultLifecycleEvent;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.DuplicateProjectException;
+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;
@@ -72,7 +75,22 @@
@Requirement
protected PlexusContainer container;
-
+
+ private void fireEvent( MavenSession session, ExecutionEventCatapult catapult )
+ {
+ List<ExecutionListener> listeners = session.getRequest().getExecutionListeners();
+
+ if ( !listeners.isEmpty() )
+ {
+ ExecutionEvent event = new DefaultLifecycleEvent( session, null );
+
+ for ( ExecutionListener listener : listeners )
+ {
+ catapult.fire( listener, event );
+ }
+ }
+ }
+
public MavenExecutionResult execute( MavenExecutionRequest request )
{
//TODO: Need a general way to inject standard properties
@@ -103,6 +121,8 @@
return processResult( result, e );
}
+ fireEvent( session, ExecutionEventCatapult.PROJECT_DISCOVERY_STARTED );
+
//TODO: optimize for the single project or no project
List<MavenProject> projects;
@@ -177,7 +197,7 @@
if ( result.hasExceptions() )
{
return result;
- }
+ }
lifecycleExecutor.execute( session );
Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java?rev=807507&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java Tue Aug 25 07:46:21 2009
@@ -0,0 +1,50 @@
+package org.apache.maven;
+
+/*
+ * 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;
+
+/**
+ * Assists in firing events from a generic method by abstracting from the actual callback method to be called on the
+ * listener.
+ *
+ * @author Benjamin Bentmann
+ */
+interface ExecutionEventCatapult
+{
+
+ /**
+ * Notifies the specified listener of the given event.
+ *
+ * @param listener The listener to notify, must not be {@code null}.
+ * @param event The event to fire, must not be {@code null}.
+ */
+ void fire( ExecutionListener listener, ExecutionEvent event );
+
+ static final ExecutionEventCatapult PROJECT_DISCOVERY_STARTED = new ExecutionEventCatapult()
+ {
+ public void fire( ExecutionListener listener, ExecutionEvent event )
+ {
+ listener.projectDiscoveryStarted( event );
+ }
+ };
+
+}
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/ExecutionEventCatapult.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Copied: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java (from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleEvent.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java?p2=maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java&p1=maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleEvent.java&r1=807111&r2=807507&rev=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleEvent.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultLifecycleEvent.java Tue Aug 25 07:46:21 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle;
+package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,17 +19,16 @@
* under the License.
*/
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
/**
- * Holds data relevant for a lifecycle event.
+ * Holds data relevant for an execution event.
*
* @author Benjamin Bentmann
*/
-class DefaultLifecycleEvent
- implements LifecycleEvent
+public class DefaultLifecycleEvent
+ implements ExecutionEvent
{
private final MavenSession session;
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Tue Aug 25 07:46:21 2009
@@ -23,7 +23,6 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.RepositoryCache;
-import org.apache.maven.lifecycle.LifecycleListener;
import org.apache.maven.model.Profile;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
@@ -119,7 +118,7 @@
private List<ArtifactRepository> pluginArtifactRepositories;
- private List<LifecycleListener> lifecycleListeners;
+ private List<ExecutionListener> lifecycleListeners;
/**
* Suppress SNAPSHOT updates.
@@ -164,7 +163,7 @@
copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
copy.setRepositoryCache( original.getRepositoryCache() );
copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
- copy.setLifecycleListeners( original.getLifecycleListeners() );
+ copy.setExecutionListeners( original.getExecutionListeners() );
return original;
}
@@ -945,21 +944,21 @@
return this;
}
- public List<LifecycleListener> getLifecycleListeners()
+ public List<ExecutionListener> getExecutionListeners()
{
if ( lifecycleListeners == null )
{
- lifecycleListeners = new ArrayList<LifecycleListener>();
+ lifecycleListeners = new ArrayList<ExecutionListener>();
}
return lifecycleListeners;
}
- public MavenExecutionRequest setLifecycleListeners( List<LifecycleListener> lifecycleListeners )
+ public MavenExecutionRequest setExecutionListeners( List<ExecutionListener> lifecycleListeners )
{
if ( lifecycleListeners != null )
{
- this.lifecycleListeners = new ArrayList<LifecycleListener>( lifecycleListeners );
+ this.lifecycleListeners = new ArrayList<ExecutionListener>( lifecycleListeners );
}
else
{
Copied: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java (from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEvent.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java?p2=maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java&p1=maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEvent.java&r1=807111&r2=807507&rev=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEvent.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionEvent.java Tue Aug 25 07:46:21 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle;
+package org.apache.maven.execution;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -19,16 +19,15 @@
* under the License.
*/
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
/**
- * Holds data relevant for a lifecycle event.
+ * Holds data relevant for an execution event.
*
* @author Benjamin Bentmann
*/
-public interface LifecycleEvent
+public interface ExecutionEvent
{
/**
Copied: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java (from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleListener.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java?p2=maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java&p1=maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleListener.java&r1=807111&r2=807507&rev=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleListener.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ExecutionListener.java Tue Aug 25 07:46:21 2009
@@ -1,4 +1,5 @@
-package org.apache.maven.lifecycle;
+package org.apache.maven.execution;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -20,37 +21,39 @@
*/
/**
- * Defines events that the lifecycle executor fires during a session.
+ * Defines events that Maven fires during a build.
*
* @author Benjamin Bentmann
*/
-public interface LifecycleListener
+public interface ExecutionListener
{
- void sessionStarted( LifecycleEvent event );
+ void projectDiscoveryStarted( ExecutionEvent event );
+
+ void sessionStarted( ExecutionEvent event );
- void sessionEnded( LifecycleEvent event );
+ void sessionEnded( ExecutionEvent event );
- void projectSkipped( LifecycleEvent event );
+ void projectSkipped( ExecutionEvent event );
- void projectStarted( LifecycleEvent event );
+ void projectStarted( ExecutionEvent event );
- void projectSucceeded( LifecycleEvent event );
+ void projectSucceeded( ExecutionEvent event );
- void projectFailed( LifecycleEvent event );
+ void projectFailed( ExecutionEvent event );
- void mojoSkipped( LifecycleEvent event );
+ void mojoSkipped( ExecutionEvent event );
- void mojoStarted( LifecycleEvent event );
+ void mojoStarted( ExecutionEvent event );
- void mojoSucceeded( LifecycleEvent event );
+ void mojoSucceeded( ExecutionEvent event );
- void mojoFailed( LifecycleEvent event );
+ void mojoFailed( ExecutionEvent event );
- void forkStarted( LifecycleEvent event );
+ void forkStarted( ExecutionEvent event );
- void forkSucceeded( LifecycleEvent event );
+ void forkSucceeded( ExecutionEvent event );
- void forkFailed( LifecycleEvent event );
+ void forkFailed( ExecutionEvent event );
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java Tue Aug 25 07:46:21 2009
@@ -27,7 +27,6 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.RepositoryCache;
-import org.apache.maven.lifecycle.LifecycleListener;
import org.apache.maven.model.Profile;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Settings;
@@ -264,8 +263,8 @@
File getUserToolchainsFile();
MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
- List<LifecycleListener> getLifecycleListeners();
- MavenExecutionRequest setLifecycleListeners( List<LifecycleListener> lifecycleListeners );
+ List<ExecutionListener> getExecutionListeners();
+ MavenExecutionRequest setExecutionListeners( List<ExecutionListener> executionListeners );
ProjectBuildingRequest getProjectBuildingRequest();
Copied: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractExecutionListener.java (from r807111, maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractLifecycleListener.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractExecutionListener.java?p2=maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractExecutionListener.java&p1=maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractLifecycleListener.java&r1=807111&r2=807507&rev=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractLifecycleListener.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/AbstractExecutionListener.java Tue Aug 25 07:46:21 2009
@@ -1,5 +1,8 @@
package org.apache.maven.lifecycle;
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.ExecutionListener;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -20,75 +23,80 @@
*/
/**
- * Provides a skeleton implementation for lifecycle listeners. The methods of this class are empty.
+ * Provides a skeleton implementation for execution listeners. The methods of this class are empty.
*
* @author Benjamin Bentmann
*/
-public class AbstractLifecycleListener
- implements LifecycleListener
+public class AbstractExecutionListener
+ implements ExecutionListener
{
- public void sessionStarted( LifecycleEvent event )
+ public void projectDiscoveryStarted( ExecutionEvent event )
+ {
+ // default does nothing
+ }
+
+ public void sessionStarted( ExecutionEvent event )
{
// default does nothing
}
- public void sessionEnded( LifecycleEvent event )
+ public void sessionEnded( ExecutionEvent event )
{
// default does nothing
}
- public void projectSkipped( LifecycleEvent event )
+ public void projectSkipped( ExecutionEvent event )
{
// default does nothing
}
- public void projectStarted( LifecycleEvent event )
+ public void projectStarted( ExecutionEvent event )
{
// default does nothing
}
- public void projectSucceeded( LifecycleEvent event )
+ public void projectSucceeded( ExecutionEvent event )
{
// default does nothing
}
- public void projectFailed( LifecycleEvent event )
+ public void projectFailed( ExecutionEvent event )
{
// default does nothing
}
- public void forkStarted( LifecycleEvent event )
+ public void forkStarted( ExecutionEvent event )
{
// default does nothing
}
- public void forkSucceeded( LifecycleEvent event )
+ public void forkSucceeded( ExecutionEvent event )
{
// default does nothing
}
- public void forkFailed( LifecycleEvent event )
+ public void forkFailed( ExecutionEvent event )
{
// default does nothing
}
- public void mojoSkipped( LifecycleEvent event )
+ public void mojoSkipped( ExecutionEvent event )
{
// default does nothing
}
- public void mojoStarted( LifecycleEvent event )
+ public void mojoStarted( ExecutionEvent event )
{
// default does nothing
}
- public void mojoSucceeded( LifecycleEvent event )
+ public void mojoSucceeded( ExecutionEvent event )
{
// default does nothing
}
- public void mojoFailed( LifecycleEvent event )
+ public void mojoFailed( ExecutionEvent event )
{
// default does nothing
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Tue Aug 25 07:46:21 2009
@@ -34,6 +34,9 @@
import org.apache.maven.artifact.repository.RepositoryRequest;
import org.apache.maven.execution.BuildFailure;
import org.apache.maven.execution.BuildSuccess;
+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;
@@ -130,13 +133,13 @@
private void fireEvent( MavenSession session, MojoExecution mojoExecution, LifecycleEventCatapult catapult )
{
- List<LifecycleListener> listeners = session.getRequest().getLifecycleListeners();
+ List<ExecutionListener> listeners = session.getRequest().getExecutionListeners();
if ( !listeners.isEmpty() )
{
- LifecycleEvent event = new DefaultLifecycleEvent( session, mojoExecution );
+ ExecutionEvent event = new DefaultLifecycleEvent( session, mojoExecution );
- for ( LifecycleListener listener : listeners )
+ for ( ExecutionListener listener : listeners )
{
catapult.fire( listener, event );
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleEventCatapult.java Tue Aug 25 07:46:21 2009
@@ -19,6 +19,9 @@
* under the License.
*/
+import org.apache.maven.execution.ExecutionEvent;
+import org.apache.maven.execution.ExecutionListener;
+
/**
* Assists in firing events from a generic method by abstracting from the actual callback method to be called on the
* listener.
@@ -34,11 +37,11 @@
* @param listener The listener to notify, must not be {@code null}.
* @param event The event to fire, must not be {@code null}.
*/
- void fire( LifecycleListener listener, LifecycleEvent event );
+ void fire( ExecutionListener listener, ExecutionEvent event );
static final LifecycleEventCatapult SESSION_STARTED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.sessionStarted( event );
}
@@ -46,7 +49,7 @@
static final LifecycleEventCatapult SESSION_ENDED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.sessionEnded( event );
}
@@ -54,7 +57,7 @@
static final LifecycleEventCatapult PROJECT_SKIPPED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.projectSkipped( event );
}
@@ -62,7 +65,7 @@
static final LifecycleEventCatapult PROJECT_STARTED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.projectStarted( event );
}
@@ -70,7 +73,7 @@
static final LifecycleEventCatapult PROJECT_SUCCEEDED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.projectSucceeded( event );
}
@@ -78,7 +81,7 @@
static final LifecycleEventCatapult PROJECT_FAILED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.projectFailed( event );
}
@@ -86,7 +89,7 @@
static final LifecycleEventCatapult MOJO_SKIPPED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.mojoSkipped( event );
}
@@ -94,7 +97,7 @@
static final LifecycleEventCatapult MOJO_STARTED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.mojoStarted( event );
}
@@ -102,7 +105,7 @@
static final LifecycleEventCatapult MOJO_SUCCEEDED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.mojoSucceeded( event );
}
@@ -110,7 +113,7 @@
static final LifecycleEventCatapult MOJO_FAILED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.mojoFailed( event );
}
@@ -118,7 +121,7 @@
static final LifecycleEventCatapult FORK_STARTED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.forkStarted( event );
}
@@ -126,7 +129,7 @@
static final LifecycleEventCatapult FORK_SUCCEEDED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.forkSucceeded( event );
}
@@ -134,7 +137,7 @@
static final LifecycleEventCatapult FORK_FAILED = new LifecycleEventCatapult()
{
- public void fire( LifecycleListener listener, LifecycleEvent event )
+ public void fire( ExecutionListener listener, ExecutionEvent event )
{
listener.forkFailed( event );
}
Copied: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java (from r807111, maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/LifecycleEventLogger.java)
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java?p2=maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java&p1=maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/LifecycleEventLogger.java&r1=807111&r2=807507&rev=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/LifecycleEventLogger.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/ExecutionEventLogger.java Tue Aug 25 07:46:21 2009
@@ -28,28 +28,28 @@
import org.apache.maven.execution.BuildFailure;
import org.apache.maven.execution.BuildSuccess;
import org.apache.maven.execution.BuildSummary;
+import org.apache.maven.execution.ExecutionEvent;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.AbstractLifecycleListener;
-import org.apache.maven.lifecycle.LifecycleEvent;
+import org.apache.maven.lifecycle.AbstractExecutionListener;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
/**
- * Logs lifecycle events to a user-supplied logger.
+ * Logs execution events to a user-supplied logger.
*
* @author Benjamin Bentmann
*/
-class LifecycleEventLogger
- extends AbstractLifecycleListener
+class ExecutionEventLogger
+ extends AbstractExecutionListener
{
private final MavenEmbedderLogger logger;
private static final int LINE_LENGTH = 72;
- public LifecycleEventLogger( MavenEmbedderLogger logger )
+ public ExecutionEventLogger( MavenEmbedderLogger logger )
{
if ( logger == null )
{
@@ -92,7 +92,16 @@
}
@Override
- public void sessionStarted( LifecycleEvent event )
+ public void projectDiscoveryStarted( ExecutionEvent event )
+ {
+ if ( logger.isInfoEnabled() )
+ {
+ logger.info( "Scanning for projects..." );
+ }
+ }
+
+ @Override
+ public void sessionStarted( ExecutionEvent event )
{
if ( logger.isInfoEnabled() && event.getSession().getProjects().size() > 1 )
{
@@ -112,7 +121,7 @@
}
@Override
- public void sessionEnded( LifecycleEvent event )
+ public void sessionEnded( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
@@ -211,7 +220,7 @@
}
@Override
- public void projectSkipped( LifecycleEvent event )
+ public void projectSkipped( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
@@ -225,7 +234,7 @@
}
@Override
- public void projectStarted( LifecycleEvent event )
+ public void projectStarted( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
@@ -238,7 +247,7 @@
}
@Override
- public void mojoSkipped( LifecycleEvent event )
+ public void mojoSkipped( ExecutionEvent event )
{
if ( logger.isWarnEnabled() )
{
@@ -248,7 +257,7 @@
}
@Override
- public void mojoStarted( LifecycleEvent event )
+ public void mojoStarted( ExecutionEvent event )
{
if ( logger.isInfoEnabled() )
{
@@ -260,7 +269,7 @@
}
@Override
- public void forkStarted( LifecycleEvent event )
+ public void forkStarted( ExecutionEvent event )
{
if ( logger.isDebugEnabled() )
{
@@ -269,7 +278,7 @@
}
@Override
- public void forkSucceeded( LifecycleEvent event )
+ public void forkSucceeded( ExecutionEvent event )
{
if ( logger.isDebugEnabled() )
{
Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=807507&r1=807506&r2=807507&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java Tue Aug 25 07:46:21 2009
@@ -29,9 +29,9 @@
import org.apache.maven.embedder.MavenEmbedderFileLogger;
import org.apache.maven.embedder.MavenEmbedderLogger;
import org.apache.maven.exception.ExceptionSummary;
+import org.apache.maven.execution.ExecutionListener;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
-import org.apache.maven.lifecycle.LifecycleListener;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.sonatype.plexus.components.cipher.DefaultPlexusCipher;
import org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher;
@@ -122,7 +122,7 @@
MavenEmbedderLogger logger = configuration.getMavenEmbedderLogger();
- request.setLifecycleListeners( Arrays.<LifecycleListener> asList( new LifecycleEventLogger( logger ) ) );
+ request.setExecutionListeners( Arrays.<ExecutionListener> asList( new ExecutionEventLogger( logger ) ) );
if ( debug || commandLine.hasOption( CLIManager.SHOW_VERSION ) )
{