o use annos where possible

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@721750 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2008-11-30 01:46:13 +00:00
parent 2911344c19
commit 9bc9c86231
3 changed files with 26 additions and 70 deletions

View File

@ -74,6 +74,10 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
@ -84,22 +88,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Single Test -->
<id>st</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/MavenEmbedderTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -19,6 +19,12 @@ package org.apache.maven.embedder.execution;
* under the License.
*/
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.apache.maven.Maven;
import org.apache.maven.artifact.manager.WagonManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
@ -34,7 +40,6 @@ 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.plugin.Mojo;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileManager;
import org.apache.maven.profiles.activation.DefaultProfileActivationContext;
@ -48,24 +53,19 @@ import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsConfigurationException;
import org.apache.maven.settings.SettingsUtils;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.MutablePlexusContainer;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.context.Context;
import org.codehaus.plexus.context.ContextException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
/**
* Things that we deal with in this populator to ensure that we have a valid {@MavenExecutionRequest}
* <p/>
@ -80,19 +80,24 @@ import java.util.Properties;
*
* @version $Id$
*/
@Component(role = MavenExecutionRequestPopulator.class)
public class DefaultMavenExecutionRequestPopulator
extends AbstractLogEnabled
implements MavenExecutionRequestPopulator,
Contextualizable
implements MavenExecutionRequestPopulator
{
@Requirement
private ArtifactRepositoryFactory artifactRepositoryFactory;
@Requirement
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
private MutablePlexusContainer container;
@Requirement
private PlexusContainer container;
@Requirement
private WagonManager wagonManager;
@Requirement
private MavenSettingsBuilder settingsBuilder;
public MavenExecutionRequest populateDefaults( MavenExecutionRequest request,
@ -657,15 +662,11 @@ public class DefaultMavenExecutionRequestPopulator
//
// ------------------------------------------------------------------------
Logger logger = container.getLoggerManager().getLoggerForComponent( Mojo.ROLE );
if ( ( request.getEventMonitors() == null ) || request.getEventMonitors().isEmpty() )
{
request.addEventMonitor( new DefaultEventMonitor( logger ) );
request.addEventMonitor( new DefaultEventMonitor( getLogger() ) );
}
container.getLoggerManager().setThreshold( request.getLoggingLevel() );
// Now, add in any event monitors from the Configuration instance.
List configEventMonitors = configuration.getEventMonitors();
@ -707,14 +708,4 @@ public class DefaultMavenExecutionRequestPopulator
request.setProfileManager( globalProfileManager );
request.setProfileActivationContext( activationContext );
}
// ----------------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------------
public void contextualize( Context context )
throws ContextException
{
container = (MutablePlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
}
}

View File

@ -19,27 +19,6 @@ under the License.
<component-set>
<components>
<component>
<role>org.apache.maven.embedder.execution.MavenExecutionRequestPopulator</role>
<implementation>org.apache.maven.embedder.execution.DefaultMavenExecutionRequestPopulator</implementation>
<requirements>
<requirement>
<role>org.apache.maven.artifact.manager.WagonManager</role>
<role-hint>default</role-hint>
</requirement>
<requirement>
<role>org.apache.maven.settings.MavenSettingsBuilder</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.repository.ArtifactRepositoryFactory</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
<role-hint>default</role-hint>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.wagon.Wagon</role>
<role-hint>http</role-hint>
@ -51,7 +30,7 @@ under the License.
<httpHeaders>
<property>
<name>User-Agent</name>
<value>Apache-Maven/${project.version} maven-artifact/${artifactVersion}</value>
<value>Apache-Maven/${project.version}</value>
</property>
</httpHeaders>
</configuration>
@ -61,13 +40,13 @@ under the License.
<role-hint>https</role-hint>
<implementation>org.apache.maven.wagon.providers.http.LightweightHttpsWagon</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<description>LIghtweightHttpsWagon</description>
<description>LightweightHttpsWagon</description>
<isolated-realm>false</isolated-realm>
<configuration>
<httpHeaders>
<property>
<name>User-Agent</name>
<value>Apache-Maven/${project.version} maven-artifact/${artifactVersion}</value>
<value>Apache-Maven/${project.version}</value>
</property>
</httpHeaders>
</configuration>