o remove eventing which was scattered all over the place, all move it all into the session and use the eventing model pattern oleg used for mercury.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@759536 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-03-28 18:12:57 +00:00
parent 5b7c683bf4
commit 505423e666
20 changed files with 7 additions and 574 deletions

View File

@ -39,9 +39,6 @@
import org.apache.maven.lifecycle.Lifecycle;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
@ -106,13 +103,7 @@ public MavenExecutionResult execute( MavenExecutionRequest request )
return result;
}
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
String event = MavenEvents.MAVEN_EXECUTION;
dispatcher.dispatchStart( event, request.getBaseDirectory() );
MavenSession session = createSession( request, reactorManager, dispatcher );
MavenSession session = createSession( request, reactorManager );
logger.info( "Scanning for projects..." );
@ -133,14 +124,12 @@ public MavenExecutionResult execute( MavenExecutionRequest request )
catch ( LifecycleExecutionException e )
{
result.addException( e );
dispatcher.dispatchError( event, request.getBaseDirectory(), e );
return result;
}
catch ( BuildFailureException e )
{
result.addException( e );
dispatcher.dispatchError( event, request.getBaseDirectory(), e );
return result;
}
@ -149,8 +138,6 @@ public MavenExecutionResult execute( MavenExecutionRequest request )
result.setProject( reactorManager.getTopLevelProject() );
dispatcher.dispatchEnd( event, request.getBaseDirectory() );
return result;
}
@ -339,7 +326,7 @@ else if ( moduleFile.isDirectory() )
// the session type would be specific to the request i.e. having a project
// or not.
protected MavenSession createSession( MavenExecutionRequest request, ReactorManager reactorManager, EventDispatcher dispatcher )
protected MavenSession createSession( MavenExecutionRequest request, ReactorManager reactorManager )
{
MavenSession session = new MavenSession( container, request );

View File

@ -22,7 +22,6 @@
import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileActivationContext;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
@ -93,8 +92,6 @@ public class DefaultMavenExecutionRequest
private boolean showErrors = false;
private List<EventMonitor> eventMonitors;
private List<String> activeProfiles;
private List<String> inactiveProfiles;
@ -143,7 +140,6 @@ public static MavenExecutionRequest copy( MavenExecutionRequest original )
copy.setProperties( original.getProperties() );
copy.setStartTime( original.getStartTime() );
copy.setShowErrors( original.isShowErrors() );
copy.setEventMonitors( original.getEventMonitors());
copy.setActiveProfiles( original.getActiveProfiles());
copy.setInactiveProfiles( original.getInactiveProfiles());
copy.setTransferListener( original.getTransferListener());
@ -217,21 +213,6 @@ public boolean isInteractiveMode()
return interactiveMode;
}
public List<EventMonitor> getEventMonitors()
{
return eventMonitors;
}
public void setBasedir( File basedir )
{
this.basedir = basedir;
}
public void setEventMonitors( List<EventMonitor> eventMonitors )
{
this.eventMonitors = eventMonitors;
}
public void setActiveProfiles( List<String> activeProfiles )
{
this.activeProfiles = activeProfiles;
@ -428,18 +409,6 @@ public MavenExecutionRequest addInactiveProfiles( List<String> profiles )
return this;
}
public MavenExecutionRequest addEventMonitor( EventMonitor monitor )
{
if ( eventMonitors == null )
{
eventMonitors = new ArrayList<EventMonitor>();
}
eventMonitors.add( monitor );
return this;
}
public MavenExecutionRequest setUseReactor( boolean reactorActive )
{
useReactor = reactorActive;

View File

@ -26,7 +26,6 @@
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileActivationContext;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.project.ProjectBuilderConfiguration;
@ -109,10 +108,6 @@ public interface MavenExecutionRequest
MavenExecutionRequest setRecursive( boolean recursive );
boolean isRecursive();
// Event monitors
MavenExecutionRequest addEventMonitor( EventMonitor monitor );
List<EventMonitor> getEventMonitors();
// Pom
MavenExecutionRequest setPomFile( String pomFilename );

View File

@ -30,8 +30,6 @@
import java.util.Set;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
@ -49,8 +47,6 @@ public class MavenSession
{
private PlexusContainer container;
private EventDispatcher eventDispatcher;
private ReactorManager reactorManager;
private MavenExecutionRequest request;
@ -78,7 +74,6 @@ public MavenSession( PlexusContainer container, MavenExecutionRequest request, L
this.container = container;
this.request = request;
this.reactorManager = new ReactorManager( projects, request.getReactorFailureBehavior() );
this.eventDispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
this.currentProject = projects.get( 0 );
}
@ -112,15 +107,6 @@ public Properties getExecutionProperties()
return request.getProperties();
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
public EventDispatcher getEventDispatcher()
{
return eventDispatcher;
}
public Settings getSettings()
{
return request.getSettings();

View File

@ -47,7 +47,7 @@ public class ReactorManager
private String failureBehavior = FAIL_FAST;
private final ProjectSorter sorter;
private ProjectSorter sorter;
private Map buildSuccessesByProject = new HashMap();

View File

@ -29,7 +29,6 @@
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.PluginLoaderException;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@ -116,10 +115,6 @@ private void executeTaskSegments( List<String> goals, MavenSession session, Mave
{
logger.info( "Building " + currentProject.getName() );
// !! This is ripe for refactoring to an aspect.
// Event monitoring.
String event = MavenEvents.PROJECT_EXECUTION;
long buildStartTime = System.currentTimeMillis();
try
@ -129,9 +124,7 @@ private void executeTaskSegments( List<String> goals, MavenSession session, Mave
for ( String goal : goals )
{
String target = currentProject.getId() + " ( " + goal + " )";
session.getEventDispatcher().dispatchStart( event, target );
executeGoalAndHandleFailures( goal, session, currentProject, event, session.getReactorManager(), buildStartTime, target );
session.getEventDispatcher().dispatchEnd( event, target );
executeGoalAndHandleFailures( goal, session, currentProject, session.getReactorManager(), buildStartTime, target );
}
}
finally
@ -144,7 +137,7 @@ private void executeTaskSegments( List<String> goals, MavenSession session, Mave
}
}
private void executeGoalAndHandleFailures( String task, MavenSession session, MavenProject project, String event, ReactorManager rm, long buildStartTime, String target )
private void executeGoalAndHandleFailures( String task, MavenSession session, MavenProject project, ReactorManager rm, long buildStartTime, String target )
throws BuildFailureException, LifecycleExecutionException
{
try
@ -153,8 +146,6 @@ private void executeGoalAndHandleFailures( String task, MavenSession session, Ma
}
catch ( LifecycleExecutionException e )
{
session.getEventDispatcher().dispatchError( event, target, e );
if ( handleExecutionFailure( rm, project, e, task, buildStartTime ) )
{
throw e;
@ -162,8 +153,6 @@ private void executeGoalAndHandleFailures( String task, MavenSession session, Ma
}
catch ( BuildFailureException e )
{
session.getEventDispatcher().dispatchError( event, target, e );
if ( handleExecutionFailure( rm, project, e, task, buildStartTime ) )
{
throw e;

View File

@ -23,10 +23,7 @@
import org.apache.maven.BuildFailureException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
/**
* @author Jason van Zyl

View File

@ -1,81 +0,0 @@
package org.apache.maven.monitor.event;
/*
* 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 java.util.Arrays;
import java.util.List;
/**
* @author jdcasey
*/
public abstract class AbstractSelectiveEventMonitor
implements EventMonitor
{
private List boundStartEvents;
private List boundErrorEvents;
private List boundEndEvents;
protected AbstractSelectiveEventMonitor(String[] startEvents, String[] endEvents, String[] errorEvents)
{
this.boundStartEvents = Arrays.asList( startEvents );
this.boundEndEvents = Arrays.asList( endEvents );
this.boundErrorEvents = Arrays.asList( errorEvents );
}
public final void startEvent( String eventName, String target, long timestamp )
{
if( boundStartEvents.contains( eventName ) )
{
doStartEvent( eventName, target, timestamp );
}
}
protected void doStartEvent( String eventName, String target, long timestamp )
{
}
public final void endEvent( String eventName, String target, long timestamp )
{
if( boundEndEvents.contains( eventName ) )
{
doEndEvent( eventName, target, timestamp );
}
}
protected void doEndEvent( String eventName, String target, long timestamp )
{
}
public final void errorEvent( String eventName, String target, long timestamp, Throwable cause )
{
if( boundErrorEvents.contains( eventName ) )
{
doErrorEvent( eventName, target, timestamp, cause );
}
}
protected void doErrorEvent( String eventName, String target, long timestamp, Throwable cause )
{
}
}

View File

@ -1,80 +0,0 @@
package org.apache.maven.monitor.event;
/*
* 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 java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* @author jdcasey
*/
public class DefaultEventDispatcher
implements EventDispatcher
{
private List eventMonitors = new ArrayList();
public DefaultEventDispatcher()
{
}
public DefaultEventDispatcher( List eventMonitors )
{
this.eventMonitors = eventMonitors;
}
public void addEventMonitors( List eventMonitors )
{
this.eventMonitors = eventMonitors;
}
public void addEventMonitor( EventMonitor monitor )
{
eventMonitors.add( monitor );
}
public void dispatchStart( String event, String target )
{
for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
{
EventMonitor monitor = (EventMonitor) it.next();
monitor.startEvent( event, target, System.currentTimeMillis() );
}
}
public void dispatchEnd( String event, String target )
{
for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
{
EventMonitor monitor = (EventMonitor) it.next();
monitor.endEvent( event, target, System.currentTimeMillis() );
}
}
public void dispatchError( String event, String target, Throwable cause )
{
for ( Iterator it = eventMonitors.iterator(); it.hasNext(); )
{
EventMonitor monitor = (EventMonitor) it.next();
monitor.errorEvent( event, target, System.currentTimeMillis(), cause );
}
}
}

View File

@ -1,93 +0,0 @@
package org.apache.maven.monitor.event;
/*
* 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.codehaus.plexus.logging.Logger;
/**
* @author jdcasey
*/
public class DefaultEventMonitor
extends AbstractSelectiveEventMonitor
{
private static final String[] START_EVENTS = {
MavenEvents.PROJECT_EXECUTION,
MavenEvents.PHASE_EXECUTION,
MavenEvents.MOJO_EXECUTION
};
private static final String[] END_EVENTS = {
MavenEvents.PHASE_EXECUTION
};
private final Logger logger;
public DefaultEventMonitor( Logger logger )
{
super( START_EVENTS, END_EVENTS, MavenEvents.NO_EVENTS );
this.logger = logger;
}
protected void doStartEvent( String event, String target, long time )
{
if ( MavenEvents.MOJO_EXECUTION.equals( event ) )
{
logger.info( "[" + target + "]" );
}
else if ( MavenEvents.PHASE_EXECUTION.equals( event ) )
{
logger.debug( line() );
logger.debug( "Entering lifecycle phase: " + target );
logger.debug( line() );
}
else if ( MavenEvents.PROJECT_EXECUTION.equals( event ) )
{
logger.info( line() );
String[] targetParts = target.split( "\n" );
logger.info( "Building " + targetParts[0] );
if ( targetParts.length > 0 )
{
logger.info( "" );
for ( int i = 1; i < targetParts.length; i++ )
{
logger.info( targetParts[i] );
}
}
logger.info( line() );
}
}
protected void doEndEvent( String event,
String target,
long timestamp )
{
logger.debug( line() );
logger.debug( "Completed lifecycle phase: " + target );
logger.debug( line() );
}
private String line()
{
return "------------------------------------------------------------------------";
}
}

View File

@ -1,36 +0,0 @@
package org.apache.maven.monitor.event;
/*
* 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.
*/
/**
* @author jdcasey
*/
public interface EventDispatcher
{
void addEventMonitor( EventMonitor monitor );
void dispatchStart( String event, String target );
void dispatchEnd( String event, String target );
void dispatchError( String event, String target, Throwable cause );
}

View File

@ -1,34 +0,0 @@
package org.apache.maven.monitor.event;
/*
* 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.
*/
/**
* @author jdcasey
*/
public interface EventMonitor
{
void startEvent( String eventName, String target, long timestamp );
void endEvent( String eventName, String target, long timestamp );
void errorEvent( String eventName, String target, long timestamp, Throwable cause );
}

View File

@ -1,69 +0,0 @@
package org.apache.maven.monitor.event;
import java.util.HashMap;
import java.util.Map;
/*
* 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.
*/
/**
* @author jdcasey
*/
public final class MavenEvents
{
public static final String PHASE_EXECUTION = "phase-execute";
public static final String MOJO_EXECUTION = "mojo-execute";
public static final String PROJECT_EXECUTION = "project-execute";
/** @deprecated Use {@link MavenEvents#MAVEN_EXECUTION} instead. */
public static final String REACTOR_EXECUTION = "reactor-execute";
public static final String MAVEN_EXECUTION = "maven-execute";
public static final String EMBEDDER_LIFECYCLE = "embedder-lifecycle";
public static final String EMBEDDER_METHOD = "embedder-method";
public static final Map DEPRECATIONS;
static
{
Map dep = new HashMap();
dep.put( MAVEN_EXECUTION, REACTOR_EXECUTION );
DEPRECATIONS = dep;
}
public static final String[] ALL_EVENTS = {
PHASE_EXECUTION,
MOJO_EXECUTION,
PROJECT_EXECUTION,
REACTOR_EXECUTION,
MAVEN_EXECUTION,
EMBEDDER_LIFECYCLE,
EMBEDDER_METHOD
};
public static final String[] NO_EVENTS = {};
private MavenEvents()
{
}
}

View File

@ -59,7 +59,6 @@
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.ReportPlugin;
import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.monitor.logging.DefaultLog;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
@ -553,8 +552,6 @@ public void executeMojo( MavenProject project, MojoExecution mojoExecution, Mave
}
}
// Event monitoring.
String event = MavenEvents.MOJO_EXECUTION;
String goalExecId = goalName;
if ( mojoExecution.getExecutionId() != null )
{
@ -587,8 +584,6 @@ public void executeMojo( MavenProject project, MojoExecution mojoExecution, Mave
}
catch ( DuplicateArtifactAttachmentException e )
{
session.getEventDispatcher().dispatchError( event, goalExecId, e );
throw new PluginExecutionException( mojoExecution, project, e );
}
@ -603,21 +598,15 @@ public void executeMojo( MavenProject project, MojoExecution mojoExecution, Mave
}
catch ( MojoExecutionException e )
{
session.getEventDispatcher().dispatchError( event, goalExecId, e );
throw new PluginExecutionException( mojoExecution, project, e );
}
catch ( MojoFailureException e )
{
session.getEventDispatcher().dispatchError( event, goalExecId, e );
throw e;
}
catch ( PluginManagerException e )
{
session.getEventDispatcher().dispatchError( event, goalExecId, e );
throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
}
finally

View File

@ -2,20 +2,14 @@
import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.monitor.event.DefaultEventMonitor;
import org.apache.maven.plugin.MavenPluginCollector;
import org.apache.maven.plugin.MavenPluginDiscoverer;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.DefaultProjectBuilderConfiguration;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
@ -24,7 +18,6 @@
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.util.FileUtils;
public abstract class AbstractCoreMavenComponentTest
@ -89,8 +82,6 @@ protected MavenSession createMavenSession( File pom )
.setLocalRepository( localRepository )
.setRemoteRepositories( Arrays.asList( remoteRepository ) )
.setGoals( Arrays.asList( new String[] { "package" } ) )
// This is wrong
.addEventMonitor( new DefaultEventMonitor( new ConsoleLogger( 0, "" ) ) )
.setProperties( new Properties() );
ProjectBuilderConfiguration configuration = new DefaultProjectBuilderConfiguration()

View File

@ -12,7 +12,6 @@
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.model.Model;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.builder.ProjectUri;
import org.apache.maven.shared.model.ModelContainer;

View File

@ -23,7 +23,6 @@
import java.util.List;
import java.util.Properties;
import org.apache.maven.monitor.event.EventMonitor;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld;
@ -127,14 +126,4 @@ public interface Configuration
void addExtension( URL url );
List<URL> getExtensions();
// ----------------------------------------------------------------------------
// Event Monitors
// ----------------------------------------------------------------------------
Configuration addEventMonitor( EventMonitor eventMonitor );
Configuration setEventMonitors( List<EventMonitor> eventMonitors );
List<EventMonitor> getEventMonitors();
}

View File

@ -24,7 +24,6 @@
import java.util.List;
import java.util.Properties;
import org.apache.maven.monitor.event.EventMonitor;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.classworlds.ClassWorld;
@ -58,8 +57,6 @@ public class DefaultConfiguration
private File localRepository;
private List<EventMonitor> eventMonitors;
/** Creates a new instance of DefaultConfiguration */
public DefaultConfiguration()
{
@ -220,27 +217,4 @@ public File getLocalRepository()
{
return localRepository;
}
public Configuration addEventMonitor( EventMonitor eventMonitor )
{
if ( eventMonitors == null )
{
eventMonitors = new ArrayList<EventMonitor>();
}
eventMonitors.add( eventMonitor );
return this;
}
public List<EventMonitor> getEventMonitors()
{
return eventMonitors;
}
public Configuration setEventMonitors( List<EventMonitor> eventMonitors )
{
this.eventMonitors = eventMonitors;
return this;
}
}

View File

@ -39,8 +39,6 @@
import org.apache.maven.model.Plugin;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.plugin.MavenPluginCollector;
import org.apache.maven.plugin.MavenPluginDiscoverer;
import org.apache.maven.plugin.PluginLoaderException;
@ -130,6 +128,8 @@ public class MavenEmbedder
private Configuration configuration;
private MavenExecutionRequest request;
// ----------------------------------------------------------------------------
// Constructors
// ----------------------------------------------------------------------------
@ -377,10 +377,6 @@ public MavenExecutionResult readProjectWithDependencies( MavenExecutionRequest r
// Lifecycle
// ----------------------------------------------------------------------
private MavenExecutionRequest request;
private EventDispatcher dispatcher;
private void start( Configuration configuration )
throws MavenEmbedderException
{
@ -459,8 +455,6 @@ private void start( Configuration configuration )
request = new DefaultMavenExecutionRequest();
populator.populateDefaults( request, configuration );
dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
}
catch ( ComponentLookupException e )
{

View File

@ -31,8 +31,6 @@
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository;
import org.apache.maven.monitor.event.DefaultEventMonitor;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileActivationContext;
import org.apache.maven.profiles.ProfileManager;
@ -80,8 +78,6 @@ public class DefaultMavenExecutionRequestPopulator
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request, Configuration configuration )
throws MavenEmbedderException
{
eventing( request, configuration );
executionProperties( request, configuration );
pom( request, configuration );
@ -410,35 +406,6 @@ public ArtifactRepository createLocalRepository( MavenExecutionRequest request,
}
}
// ------------------------------------------------------------------------
// Eventing
// ------------------------------------------------------------------------
private void eventing( MavenExecutionRequest request, Configuration configuration )
{
// ------------------------------------------------------------------------
// Event Monitor/Logging
//
//
// ------------------------------------------------------------------------
if ( ( request.getEventMonitors() == null ) || request.getEventMonitors().isEmpty() )
{
request.addEventMonitor( new DefaultEventMonitor( getLogger() ) );
}
// Now, add in any event monitors from the Configuration instance.
List<EventMonitor> configEventMonitors = configuration.getEventMonitors();
if ( ( configEventMonitors != null ) && !configEventMonitors.isEmpty() )
{
for ( EventMonitor monitor : configEventMonitors )
{
request.addEventMonitor( monitor );
}
}
}
// ------------------------------------------------------------------------
// Profile Manager
// ------------------------------------------------------------------------