mirror of https://github.com/apache/maven.git
o move more configuration to one location
o removing uneeded components from DefaultMaven git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@491532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8120d856c7
commit
439ba113d7
|
@ -18,7 +18,6 @@ package org.apache.maven;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
|
|
||||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.execution.BuildFailure;
|
import org.apache.maven.execution.BuildFailure;
|
||||||
|
@ -30,10 +29,8 @@ import org.apache.maven.execution.ReactorManager;
|
||||||
import org.apache.maven.execution.RuntimeInformation;
|
import org.apache.maven.execution.RuntimeInformation;
|
||||||
import org.apache.maven.lifecycle.LifecycleExecutor;
|
import org.apache.maven.lifecycle.LifecycleExecutor;
|
||||||
import org.apache.maven.monitor.event.DefaultEventDispatcher;
|
import org.apache.maven.monitor.event.DefaultEventDispatcher;
|
||||||
import org.apache.maven.monitor.event.DefaultEventMonitor;
|
|
||||||
import org.apache.maven.monitor.event.EventDispatcher;
|
import org.apache.maven.monitor.event.EventDispatcher;
|
||||||
import org.apache.maven.monitor.event.MavenEvents;
|
import org.apache.maven.monitor.event.MavenEvents;
|
||||||
import org.apache.maven.plugin.Mojo;
|
|
||||||
import org.apache.maven.profiles.DefaultProfileManager;
|
import org.apache.maven.profiles.DefaultProfileManager;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||||
|
@ -46,15 +43,10 @@ import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.usability.diagnostics.ErrorDiagnostics;
|
import org.apache.maven.usability.diagnostics.ErrorDiagnostics;
|
||||||
import org.codehaus.plexus.PlexusConstants;
|
import org.codehaus.plexus.PlexusConstants;
|
||||||
import org.codehaus.plexus.PlexusContainer;
|
import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
|
||||||
import org.codehaus.plexus.context.Context;
|
import org.codehaus.plexus.context.Context;
|
||||||
import org.codehaus.plexus.context.ContextException;
|
import org.codehaus.plexus.context.ContextException;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
import org.codehaus.plexus.logging.Logger;
|
|
||||||
import org.codehaus.plexus.logging.LoggerManager;
|
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.codehaus.plexus.util.dag.CycleDetectedException;
|
import org.codehaus.plexus.util.dag.CycleDetectedException;
|
||||||
|
|
||||||
|
@ -76,7 +68,7 @@ import java.util.TimeZone;
|
||||||
*/
|
*/
|
||||||
public class DefaultMaven
|
public class DefaultMaven
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements Maven, Contextualizable, Initializable
|
implements Maven, Contextualizable
|
||||||
{
|
{
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Components
|
// Components
|
||||||
|
@ -92,10 +84,6 @@ public class DefaultMaven
|
||||||
|
|
||||||
protected RuntimeInformation runtimeInformation;
|
protected RuntimeInformation runtimeInformation;
|
||||||
|
|
||||||
protected LoggerManager loggerManager;
|
|
||||||
|
|
||||||
protected ArtifactRepositoryFactory artifactRepositoryFactory;
|
|
||||||
|
|
||||||
private static final long MB = 1024 * 1024;
|
private static final long MB = 1024 * 1024;
|
||||||
|
|
||||||
private static final int MS_PER_SEC = 1000;
|
private static final int MS_PER_SEC = 1000;
|
||||||
|
@ -108,15 +96,6 @@ public class DefaultMaven
|
||||||
|
|
||||||
public MavenExecutionResult execute( MavenExecutionRequest request )
|
public MavenExecutionResult execute( MavenExecutionRequest request )
|
||||||
{
|
{
|
||||||
Logger logger = loggerManager.getLoggerForComponent( Mojo.ROLE );
|
|
||||||
|
|
||||||
if ( request.getEventMonitors() == null )
|
|
||||||
{
|
|
||||||
request.addEventMonitor( new DefaultEventMonitor( logger ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
loggerManager.setThreshold( request.getLoggingLevel() );
|
|
||||||
|
|
||||||
request.setStartTime( new Date() );
|
request.setStartTime( new Date() );
|
||||||
|
|
||||||
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
|
EventDispatcher dispatcher = new DefaultEventDispatcher( request.getEventMonitors() );
|
||||||
|
@ -538,19 +517,6 @@ public class DefaultMaven
|
||||||
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initialize()
|
|
||||||
throws InitializationException
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
loggerManager = (LoggerManager) container.lookup( LoggerManager.ROLE );
|
|
||||||
}
|
|
||||||
catch ( ComponentLookupException e )
|
|
||||||
{
|
|
||||||
throw new InitializationException( "Cannot lookup logger manager.", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Reporting / Logging
|
// Reporting / Logging
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
|
@ -82,15 +82,6 @@
|
||||||
<requirement>
|
<requirement>
|
||||||
<role>org.apache.maven.execution.RuntimeInformation</role>
|
<role>org.apache.maven.execution.RuntimeInformation</role>
|
||||||
</requirement>
|
</requirement>
|
||||||
<requirement>
|
|
||||||
<role>org.apache.maven.artifact.manager.WagonManager</role>
|
|
||||||
</requirement>
|
|
||||||
<requirement>
|
|
||||||
<role>org.apache.maven.MavenTools</role>
|
|
||||||
</requirement>
|
|
||||||
<requirement>
|
|
||||||
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
|
|
||||||
</requirement>
|
|
||||||
</requirements>
|
</requirements>
|
||||||
</component>
|
</component>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,8 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.maven.MavenTools;
|
import org.apache.maven.MavenTools;
|
||||||
import org.apache.maven.SettingsConfigurationException;
|
import org.apache.maven.SettingsConfigurationException;
|
||||||
|
import org.apache.maven.monitor.event.DefaultEventMonitor;
|
||||||
|
import org.apache.maven.plugin.Mojo;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.apache.maven.settings.Proxy;
|
import org.apache.maven.settings.Proxy;
|
||||||
import org.apache.maven.settings.Server;
|
import org.apache.maven.settings.Server;
|
||||||
|
@ -16,6 +18,7 @@ import org.apache.maven.artifact.manager.WagonManager;
|
||||||
import org.apache.maven.embedder.MavenEmbedderException;
|
import org.apache.maven.embedder.MavenEmbedderException;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
|
import org.codehaus.plexus.logging.Logger;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||||
|
@ -161,6 +164,17 @@ public class DefaultMavenExecutionRequestDefaultsPopulator
|
||||||
request.setBaseDirectory( new File( request.getPomFile() ) );
|
request.setBaseDirectory( new File( request.getPomFile() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EventMonitor/Logger
|
||||||
|
|
||||||
|
Logger logger = container.getLoggerManager().getLoggerForComponent( Mojo.ROLE );
|
||||||
|
|
||||||
|
if ( request.getEventMonitors() == null )
|
||||||
|
{
|
||||||
|
request.addEventMonitor( new DefaultEventMonitor( logger ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
container.getLoggerManager().setThreshold( request.getLoggingLevel() );
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue