mirror of https://github.com/apache/maven.git
o use the class lookup method which will now automatically partition lookups based on the class
submitted by: Dain Sundstrom git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@717964 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d28d1719a
commit
56986ca004
|
@ -45,6 +45,14 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-metadata</artifactId>
|
||||
<version>1.0-beta-3-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-beta-3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
|
|
@ -129,6 +129,18 @@ public class MavenSession
|
|||
return container.lookup( role, roleHint );
|
||||
}
|
||||
|
||||
public <T> T lookup( Class<T> type )
|
||||
throws ComponentLookupException
|
||||
{
|
||||
return container.lookup( type );
|
||||
}
|
||||
|
||||
public <T> T lookup( Class<T> type, String roleHint )
|
||||
throws ComponentLookupException
|
||||
{
|
||||
return container.lookup( type, roleHint );
|
||||
}
|
||||
|
||||
public List lookupList( String role )
|
||||
throws ComponentLookupException
|
||||
{
|
||||
|
|
|
@ -367,7 +367,7 @@ public class DefaultLifecycleExecutor
|
|||
* from the core Maven realm, and contains the specific build-extension
|
||||
* components referenced in that project, the lookup realms must be managed for
|
||||
* each project that's used to fire off a mojo execution. This helps ensure
|
||||
* that unsafe {@link PlexusContainer#lookup(String)} and related calls will
|
||||
* that unsafe {@link PlexusContainer#lookup} and related calls will
|
||||
* have access to these build-extension components.
|
||||
* <br />
|
||||
* This method simply restores the original Maven-core lookup realm when a
|
||||
|
@ -386,7 +386,7 @@ public class DefaultLifecycleExecutor
|
|||
* from the core Maven realm, and contains the specific build-extension
|
||||
* components referenced in that project, the lookup realms must be managed for
|
||||
* each project that's used to fire off a mojo execution. This helps ensure
|
||||
* that unsafe {@link PlexusContainer#lookup(String)} and related calls will
|
||||
* that unsafe {@link PlexusContainer#lookup} and related calls will
|
||||
* have access to these build-extension components.
|
||||
* <br />
|
||||
* This method is meant to find a project-specific realm, if one exists, for
|
||||
|
|
|
@ -815,12 +815,12 @@ public class DefaultPluginManager
|
|||
getLogger().debug(
|
||||
"Looking up mojo " + mojoDescriptor.getRoleHint() + " in realm "
|
||||
+ pluginRealm.getId() + " - descRealmId="
|
||||
+ mojoDescriptor.getRealmId() );
|
||||
+ mojoDescriptor.getRealm() );
|
||||
|
||||
Mojo mojo;
|
||||
try
|
||||
{
|
||||
mojo = (Mojo) container.lookup( Mojo.ROLE, mojoDescriptor.getRoleHint(), pluginRealm );
|
||||
mojo = container.lookup( Mojo.class, mojoDescriptor.getRoleHint() );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
|
@ -1344,11 +1344,11 @@ public class DefaultPluginManager
|
|||
// so that this meethod could entirely be handled by a plexus lookup?
|
||||
if ( StringUtils.isNotEmpty( configuratorId ) )
|
||||
{
|
||||
configurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, configuratorId, realm );
|
||||
configurator = container.lookup( ComponentConfigurator.class, configuratorId );
|
||||
}
|
||||
else
|
||||
{
|
||||
configurator = (ComponentConfigurator) container.lookup( ComponentConfigurator.ROLE, "basic", realm );
|
||||
configurator = container.lookup( ComponentConfigurator.class, "basic" );
|
||||
}
|
||||
|
||||
ConfigurationListener listener = new DebugConfigurationListener( getLogger() );
|
||||
|
|
|
@ -186,7 +186,7 @@ public class DefaultMavenRealmManager
|
|||
// that allows most of the extension to stay hidden, and the
|
||||
// specific local extension components are still accessible
|
||||
// from the project-level realm.
|
||||
comp.setRealmId( realm.getId() );
|
||||
comp.setRealm( realm );
|
||||
|
||||
// Finally, add the extension component's descriptor (with projectRealm
|
||||
// set as the lookup realm) to the container.
|
||||
|
|
|
@ -21,7 +21,7 @@ public class DefaultMavenRealmManagerTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
factory = lookup( ArtifactFactory.class );
|
||||
}
|
||||
|
||||
public void test_ReuseSingleExtensionRealmFromMultipleProjectRealms_UsingTwoManagerInstances()
|
||||
|
@ -57,9 +57,7 @@ public class DefaultMavenRealmManagerTest
|
|||
|
||||
mgr1.importExtensionsIntoProjectRealm( "org.group", pAid1, "2", ext1 );
|
||||
|
||||
String targetClass = ArtifactFactory.ROLE;
|
||||
|
||||
Object result1 = getContainer().lookup( targetClass, "test", mgr1.getProjectRealm( "org.group", pAid1, "2" ) );
|
||||
ArtifactFactory result1 = getContainer().lookup( ArtifactFactory.class, "test" );
|
||||
|
||||
assertNotNull( result1 );
|
||||
|
||||
|
@ -72,7 +70,7 @@ public class DefaultMavenRealmManagerTest
|
|||
// ext2 doesn't have a file associated with it, but it SHOULD succeed anyway.
|
||||
mgr2.importExtensionsIntoProjectRealm( "org.group", pAid2, "2", ext2 );
|
||||
|
||||
Object result2 = getContainer().lookup( targetClass, "test", mgr2.getProjectRealm( "org.group", pAid2, "2" ) );
|
||||
ArtifactFactory result2 = getContainer().lookup( ArtifactFactory.class, "test" );
|
||||
|
||||
assertNotNull( result2 );
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ public class LegacyLifecycleMappingParserTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
parser = (LegacyLifecycleMappingParser) lookup( LegacyLifecycleMappingParser.ROLE, "default" );
|
||||
parser = lookup( LegacyLifecycleMappingParser.class, "default" );
|
||||
|
||||
testComponent = (LegacyLifecycleParsingTestComponent) lookup( LegacyLifecycleParsingTestComponent.ROLE, "default" );
|
||||
testMapping = (LifecycleMapping) lookup( LifecycleMapping.ROLE, "test-mapping" );
|
||||
testMapping2 = (LifecycleMapping) lookup( LifecycleMapping.ROLE, "test-mapping2" );
|
||||
testComponent = lookup( LegacyLifecycleParsingTestComponent.class, "default" );
|
||||
testMapping = lookup( LifecycleMapping.class, "test-mapping" );
|
||||
testMapping2 = lookup( LifecycleMapping.class, "test-mapping2" );
|
||||
}
|
||||
|
||||
public void tearDown()
|
||||
|
|
|
@ -44,7 +44,7 @@ public class DefaultLifecycleBindingManagerTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
mgr = (LifecycleBindingManager) lookup( LifecycleBindingManager.ROLE, "default" );
|
||||
mgr = lookup( LifecycleBindingManager.class, "default" );
|
||||
}
|
||||
|
||||
public void testLookup()
|
||||
|
|
|
@ -17,7 +17,7 @@ public class DefaultMojoBindingFactoryTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
factory = (MojoBindingFactory) lookup( MojoBindingFactory.ROLE, "default" );
|
||||
factory = lookup( MojoBindingFactory.class, "default" );
|
||||
}
|
||||
|
||||
public void testPrefixGoalSpec_PrefixReferenceNotAllowed()
|
||||
|
|
|
@ -44,8 +44,8 @@ public class DefaultBuildPlannerTest
|
|||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
buildPlanner = (DefaultBuildPlanner) lookup( BuildPlanner.class.getName(), "default" );
|
||||
pluginLoader = (TestPluginLoader) lookup( PluginLoader.class.getName(), "default" );
|
||||
buildPlanner = (DefaultBuildPlanner) lookup( BuildPlanner.class );
|
||||
pluginLoader = (TestPluginLoader) lookup( PluginLoader.class );
|
||||
}
|
||||
|
||||
public void test_constructBuildPlan_ForkedPhaseFromMojoBoundInThatPhase()
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.apache.maven.path.PathTranslator;
|
|||
import org.apache.maven.settings.Settings;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
import org.codehaus.plexus.MutablePlexusContainer;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
|
@ -73,8 +74,8 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
pathTranslator = (PathTranslator) lookup( PathTranslator.ROLE );
|
||||
factory = lookup( ArtifactFactory.class );
|
||||
pathTranslator = lookup( PathTranslator.class );
|
||||
}
|
||||
|
||||
public void testPluginDescriptorExpressionReference()
|
||||
|
@ -108,7 +109,7 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
null,
|
||||
Artifact.SCOPE_COMPILE );
|
||||
|
||||
List deps = new ArrayList();
|
||||
List<Artifact> deps = new ArrayList<Artifact>();
|
||||
deps.add( depArtifact );
|
||||
|
||||
exec.getMojoDescriptor().getPluginDescriptor().setArtifacts( deps );
|
||||
|
@ -139,7 +140,7 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
null,
|
||||
Artifact.SCOPE_COMPILE );
|
||||
|
||||
List deps = new ArrayList();
|
||||
List<Artifact> deps = new ArrayList<Artifact>();
|
||||
deps.add( depArtifact );
|
||||
|
||||
exec.getMojoDescriptor().getPluginDescriptor().setArtifacts( deps );
|
||||
|
@ -419,12 +420,11 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
Properties executionProperties )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepositoryLayout repoLayout =
|
||||
(ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "legacy" );
|
||||
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
|
||||
|
||||
ArtifactRepository repo = new DefaultArtifactRepository( "local", "target/repo", repoLayout );
|
||||
|
||||
PlexusContainer container = getContainer();
|
||||
MutablePlexusContainer container = (MutablePlexusContainer) getContainer();
|
||||
MavenSession session = createSession( container, repo );
|
||||
|
||||
MojoDescriptor mojo = new MojoDescriptor();
|
||||
|
@ -442,7 +442,7 @@ public class PluginParameterExpressionEvaluatorTest
|
|||
String version )
|
||||
throws Exception
|
||||
{
|
||||
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
ArtifactFactory artifactFactory = lookup( ArtifactFactory.class );
|
||||
|
||||
// TODO: used to be SCOPE_COMPILE, check
|
||||
return artifactFactory.createBuildArtifact( groupId, artifactId, version, "jar" );
|
||||
|
|
|
@ -105,7 +105,7 @@ public abstract class AbstractConsoleDownloadMonitor
|
|||
public void transferError( TransferEvent transferEvent )
|
||||
{
|
||||
// TODO: can't use getLogger() because this isn't currently instantiated as a component
|
||||
transferEvent.getException().printStackTrace();
|
||||
// transferEvent.getException().printStackTrace();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -324,7 +324,7 @@ public class MavenEmbedder
|
|||
ArtifactNotFoundException, InvalidPluginException, PluginManagerException,
|
||||
PluginNotFoundException, PluginVersionNotFoundException
|
||||
{
|
||||
PluginManager pluginManager = (PluginManager) container.lookup( PluginManager.ROLE );
|
||||
PluginManager pluginManager = container.lookup( PluginManager.class );
|
||||
|
||||
// MavenSession session = new MavenSession( container, request, null, null, projectSessions );
|
||||
MavenSession session = new MavenSession( container, request, null, null );
|
||||
|
@ -611,7 +611,7 @@ public class MavenEmbedder
|
|||
ContainerConfiguration cc = new DefaultContainerConfiguration()
|
||||
.addComponentDiscoverer( new MavenPluginDiscoverer() )
|
||||
.addComponentDiscoveryListener( new MavenPluginCollector() )
|
||||
.setClassWorld( classWorld ).setParentContainer( configuration.getParentContainer() ).setName( "embedder" );
|
||||
.setClassWorld( classWorld ).setName( "embedder" );
|
||||
|
||||
container = new DefaultPlexusContainer( cc );
|
||||
}
|
||||
|
@ -646,23 +646,23 @@ public class MavenEmbedder
|
|||
|
||||
modelWriter = new MavenXpp3Writer();
|
||||
|
||||
maven = (Maven) container.lookup( Maven.ROLE );
|
||||
maven = container.lookup( Maven.class );
|
||||
|
||||
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
|
||||
mavenProjectBuilder = container.lookup( MavenProjectBuilder.class );
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Artifact related components
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
artifactFactory = (ArtifactFactory) container.lookup( ArtifactFactory.ROLE );
|
||||
artifactFactory = container.lookup( ArtifactFactory.class );
|
||||
|
||||
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE, "default" );
|
||||
artifactResolver = container.lookup( ArtifactResolver.class );
|
||||
|
||||
populator = (MavenExecutionRequestPopulator) container.lookup( MavenExecutionRequestPopulator.ROLE );
|
||||
populator = container.lookup( MavenExecutionRequestPopulator.class );
|
||||
|
||||
buildPlanner = (BuildPlanner) container.lookup( BuildPlanner.class );
|
||||
buildPlanner = container.lookup( BuildPlanner.class );
|
||||
|
||||
artifactHandlerManager = (ArtifactHandlerManager) container.lookup( ArtifactHandlerManager.ROLE );
|
||||
artifactHandlerManager = container.lookup( ArtifactHandlerManager.class );
|
||||
|
||||
// This is temporary as we can probably cache a single request and use it for default values and
|
||||
// simply cascade values in from requests used for individual executions.
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.apache.maven.settings.SettingsUtils;
|
|||
import org.apache.maven.wagon.repository.RepositoryPermissions;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.MutablePlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
|
@ -89,7 +90,7 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
|
||||
private ArtifactRepositoryLayout defaultArtifactRepositoryLayout;
|
||||
|
||||
private PlexusContainer container;
|
||||
private MutablePlexusContainer container;
|
||||
|
||||
private WagonManager wagonManager;
|
||||
|
||||
|
@ -574,7 +575,7 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
private void resolveParameters( Settings settings )
|
||||
throws ComponentLookupException, ComponentLifecycleException, SettingsConfigurationException
|
||||
{
|
||||
WagonManager wagonManager = (WagonManager) container.lookup( WagonManager.ROLE );
|
||||
WagonManager wagonManager = container.lookup( WagonManager.class );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -715,6 +716,6 @@ public class DefaultMavenExecutionRequestPopulator
|
|||
public void contextualize( Context context )
|
||||
throws ContextException
|
||||
{
|
||||
container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||
container = (MutablePlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,12 +86,12 @@ public class MavenEmbedderProjectWithExtensionReadingTest
|
|||
.setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() ) );
|
||||
}
|
||||
|
||||
protected Map getPluginExtensionComponents( Plugin plugin )
|
||||
protected Map<String, ArtifactHandler> getPluginExtensionComponents( Plugin plugin )
|
||||
throws PluginManagerException
|
||||
{
|
||||
try
|
||||
{
|
||||
return getPlexusContainer().lookupMap( ArtifactHandler.ROLE );
|
||||
return getPlexusContainer().lookupMap( ArtifactHandler.class );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ClassLoaderXmlBindingLoaderTest
|
|||
public void testComponentAccess_ParseSingleCleanBinding()
|
||||
throws Exception
|
||||
{
|
||||
LifecycleBindingLoader loader = (LifecycleBindingLoader) lookup( LifecycleBindingLoader.ROLE, "single-clean-mapping" );
|
||||
LifecycleBindingLoader loader = lookup( LifecycleBindingLoader.class, "single-clean-mapping" );
|
||||
|
||||
LifecycleBindings bindings = loader.getBindings();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.maven.profiles.activation.ProfileActivationContext;
|
|||
import org.apache.maven.profiles.activation.ProfileActivationException;
|
||||
import org.apache.maven.profiles.activation.ProfileActivator;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.MutablePlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
|
||||
|
@ -41,7 +42,7 @@ import java.util.Map.Entry;
|
|||
public class DefaultProfileManager
|
||||
implements ProfileManager
|
||||
{
|
||||
private PlexusContainer container;
|
||||
private MutablePlexusContainer container;
|
||||
|
||||
private Map profilesById = new LinkedHashMap();
|
||||
|
||||
|
@ -53,7 +54,7 @@ public class DefaultProfileManager
|
|||
*/
|
||||
public DefaultProfileManager( PlexusContainer container, ProfileActivationContext profileActivationContext )
|
||||
{
|
||||
this.container = container;
|
||||
this.container = (MutablePlexusContainer) container;
|
||||
if ( profileActivationContext == null )
|
||||
{
|
||||
this.profileActivationContext = createDefaultActivationContext();
|
||||
|
@ -70,7 +71,7 @@ public class DefaultProfileManager
|
|||
*/
|
||||
public DefaultProfileManager( PlexusContainer container )
|
||||
{
|
||||
this.container = container;
|
||||
this.container = (MutablePlexusContainer) container;
|
||||
|
||||
profileActivationContext = createDefaultActivationContext();
|
||||
}
|
||||
|
@ -259,16 +260,14 @@ public class DefaultProfileManager
|
|||
private boolean isActive( Profile profile, ProfileActivationContext context )
|
||||
throws ProfileActivationException
|
||||
{
|
||||
List activators = null;
|
||||
List<ProfileActivator> activators = null;
|
||||
|
||||
try
|
||||
{
|
||||
activators = container.lookupList( ProfileActivator.ROLE );
|
||||
activators = container.lookupList( ProfileActivator.class );
|
||||
|
||||
for ( Iterator activatorIterator = activators.iterator(); activatorIterator.hasNext(); )
|
||||
for ( ProfileActivator activator : activators )
|
||||
{
|
||||
ProfileActivator activator = (ProfileActivator) activatorIterator.next();
|
||||
|
||||
if ( activator.canDetermineActivation( profile, context ) )
|
||||
{
|
||||
if ( activator.isActive( profile, context ) )
|
||||
|
|
|
@ -84,7 +84,7 @@ public class CustomActivator
|
|||
|
||||
try
|
||||
{
|
||||
activator = (ProfileActivator) container.lookup( ProfileActivator.ROLE, type );
|
||||
activator = container.lookup( ProfileActivator.class, type );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
|
|
|
@ -51,12 +51,12 @@ public abstract class AbstractMavenProjectTestCase
|
|||
|
||||
if ( getContainer().hasComponent( MavenProjectBuilder.ROLE, "test" ) )
|
||||
{
|
||||
projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE, "test" );
|
||||
projectBuilder = lookup( MavenProjectBuilder.class, "test" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// default over to the main project builder...
|
||||
projectBuilder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
|
||||
projectBuilder = lookup( MavenProjectBuilder.class );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,8 +95,7 @@ public abstract class AbstractMavenProjectTestCase
|
|||
protected ArtifactRepository getLocalRepository()
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
|
||||
|
||||
ArtifactRepository r = new DefaultArtifactRepository( "local",
|
||||
"file://" + getLocalRepositoryPath().getAbsolutePath(),
|
||||
|
|
|
@ -50,7 +50,7 @@ public class DefaultMavenProjectBuilderTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
projectBuilder = (DefaultMavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
|
||||
projectBuilder = lookup( MavenProjectBuilder.class );
|
||||
|
||||
localRepoDir = new File( System.getProperty( "java.io.tmpdir" ), "local-repo." + System.currentTimeMillis() );
|
||||
localRepoDir.mkdirs();
|
||||
|
@ -115,8 +115,7 @@ public class DefaultMavenProjectBuilderTest
|
|||
protected ArtifactRepository getLocalRepository()
|
||||
throws Exception
|
||||
{
|
||||
ArtifactRepositoryLayout repoLayout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE,
|
||||
"legacy" );
|
||||
ArtifactRepositoryLayout repoLayout = lookup( ArtifactRepositoryLayout.class, "legacy" );
|
||||
|
||||
ArtifactRepository r = new DefaultArtifactRepository( "local", "file://" + localRepoDir.getAbsolutePath(),
|
||||
repoLayout );
|
||||
|
|
|
@ -20,8 +20,8 @@ public class DefaultMavenProjectHelperTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
mavenProjectHelper = (MavenProjectHelper) lookup( MavenProjectHelper.ROLE );
|
||||
artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
mavenProjectHelper = lookup( MavenProjectHelper.class );
|
||||
artifactFactory = lookup( ArtifactFactory.class );
|
||||
}
|
||||
|
||||
public void testShouldThrowExceptionWhenDuplicateAttachmentIsAdded()
|
||||
|
|
|
@ -38,9 +38,9 @@ public class ProjectClasspathTest
|
|||
File f = getFileForClasspathResource( dir + "project-with-scoped-dependencies.xml" );
|
||||
|
||||
// assertEquals( TestArtifactResolver.class, getContainer().lookup( ArtifactResolver.ROLE ).getClass() );
|
||||
TestProjectBuilder builder = (TestProjectBuilder) getContainer().lookup( MavenProjectBuilder.ROLE, "test" );
|
||||
TestProjectBuilder builder = (TestProjectBuilder) getContainer().lookup( MavenProjectBuilder.class, "test" );
|
||||
|
||||
TestArtifactResolver testArtifactResolver = (TestArtifactResolver) getContainer().lookup( TestArtifactResolver.class.getName() );
|
||||
TestArtifactResolver testArtifactResolver = getContainer().lookup( TestArtifactResolver.class );
|
||||
|
||||
builder.setArtifactResolver( testArtifactResolver );
|
||||
builder.setArtifactMetadataSource( testArtifactResolver.source() );
|
||||
|
|
|
@ -38,7 +38,7 @@ public class SuperPomProjectBuilderTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
projectBuilder = (DefaultMavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
|
||||
projectBuilder = lookup( MavenProjectBuilder.class );
|
||||
}
|
||||
|
||||
public void testStandaloneSuperPomContainsInjectedExternalProfileRepositories()
|
||||
|
|
|
@ -66,7 +66,7 @@ public class MavenMetadataSourceTest
|
|||
deps.add( dep1 );
|
||||
deps.add( dep2 );
|
||||
|
||||
ArtifactFactory factory = ( ArtifactFactory ) lookup( ArtifactFactory.ROLE );
|
||||
ArtifactFactory factory = lookup( ArtifactFactory.class );
|
||||
|
||||
ArtifactFilter dependencyFilter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE );
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class MavenMetadataSourceTest
|
|||
|
||||
MavenProject project = new MavenProject( model );
|
||||
|
||||
ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
ArtifactFactory factory = lookup( ArtifactFactory.class );
|
||||
|
||||
project.setArtifacts( project.createArtifacts( factory, null, null ) );
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class MavenMetadataSourceTest
|
|||
|
||||
injector.injectDefaults( model );
|
||||
|
||||
ArtifactFactory factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
|
||||
ArtifactFactory factory = lookup( ArtifactFactory.class );
|
||||
|
||||
project.setArtifacts( project.createArtifacts( factory, null, null ) );
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ public class DefaultModelValidatorTest
|
|||
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
|
||||
validator = (ModelValidator) lookup( ModelValidator.ROLE );
|
||||
validator = lookup( ModelValidator.class );
|
||||
|
||||
model = reader.read( input );
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ import java.util.Set;
|
|||
* Provides methods for marshalling and unmarshalling XML that does not contain attributes.
|
||||
*/
|
||||
public final class ModelMarshaller
|
||||
implements ModelPropertiesGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
|
@ -47,6 +48,16 @@ public final class ModelMarshaller
|
|||
{
|
||||
}
|
||||
|
||||
public List<ModelProperty> generateModelProperties( InputStream inputStream, String baseUri, Set<String> collections )
|
||||
throws IOException
|
||||
{
|
||||
return marshallXmlToModelProperties( inputStream, baseUri, collections );
|
||||
}
|
||||
|
||||
public void registerModelPropertyListener( String uri )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of model properties transformed from the specified input stream.
|
||||
*
|
||||
|
|
|
@ -77,7 +77,7 @@ public class DefaultToolchainManager extends AbstractLogEnabled
|
|||
try
|
||||
{
|
||||
PersistedToolchains pers = readToolchainSettings ();
|
||||
Map factories = container.lookupMap( ToolchainFactory.ROLE );
|
||||
Map<String, ToolchainFactory> factories = container.lookupMap( ToolchainFactory.class );
|
||||
List toRet = new ArrayList( );
|
||||
if ( pers != null )
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ public class DefaultToolchainManager extends AbstractLogEnabled
|
|||
while ( it.hasNext() )
|
||||
{
|
||||
ToolchainModel toolchainModel = (ToolchainModel) it.next();
|
||||
ToolchainFactory fact = (ToolchainFactory) factories.get( toolchainModel.getType() );
|
||||
ToolchainFactory fact = factories.get( toolchainModel.getType() );
|
||||
if ( fact != null )
|
||||
{
|
||||
toRet.add( fact.createToolchain( toolchainModel ) );
|
||||
|
@ -100,11 +100,9 @@ public class DefaultToolchainManager extends AbstractLogEnabled
|
|||
}
|
||||
}
|
||||
}
|
||||
Iterator it = factories.values().iterator();
|
||||
while ( it.hasNext() )
|
||||
for ( ToolchainFactory toolchainFactory : factories.values() )
|
||||
{
|
||||
ToolchainFactory fact = (ToolchainFactory) it.next();
|
||||
ToolchainPrivate tool = fact.createDefaultToolchain();
|
||||
ToolchainPrivate tool = toolchainFactory.createDefaultToolchain();
|
||||
if ( tool != null )
|
||||
{
|
||||
toRet.add( tool );
|
||||
|
@ -136,7 +134,7 @@ public class DefaultToolchainManager extends AbstractLogEnabled
|
|||
{
|
||||
try
|
||||
{
|
||||
ToolchainFactory fact = (ToolchainFactory) container.lookup(ToolchainFactory.ROLE, type);
|
||||
ToolchainFactory fact = container.lookup(ToolchainFactory.class, type);
|
||||
return fact.createToolchain( model );
|
||||
}
|
||||
catch ( ComponentLookupException ex )
|
||||
|
|
6
pom.xml
6
pom.xml
|
@ -156,7 +156,7 @@ under the License.
|
|||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-metadata</artifactId>
|
||||
<version>1.0-beta-1.2</version>
|
||||
<version>1.0-beta-3-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -280,12 +280,12 @@ under the License.
|
|||
<properties>
|
||||
<artifactVersion>3.0-alpha-2-SNAPSHOT</artifactVersion>
|
||||
<aspectjVersion>1.5.3</aspectjVersion>
|
||||
<classWorldsVersion>1.2-alpha-13</classWorldsVersion>
|
||||
<classWorldsVersion>1.2</classWorldsVersion>
|
||||
<commonsCliVersion>1.0</commonsCliVersion>
|
||||
<doxiaVersion>1.0-alpha-9</doxiaVersion>
|
||||
<easyMockVersion>1.2_Java1.3</easyMockVersion>
|
||||
<junitVersion>3.8.1</junitVersion>
|
||||
<plexusVersion>1.0-beta-1.2</plexusVersion>
|
||||
<plexusVersion>1.0-beta-2-SNAPSHOT</plexusVersion>
|
||||
<plexusInteractivityVersion>1.0-alpha-6</plexusInteractivityVersion>
|
||||
<plexusInterpolationVersion>1.1</plexusInterpolationVersion>
|
||||
<plexusUtilsVersion>1.5.5</plexusUtilsVersion>
|
||||
|
|
Loading…
Reference in New Issue