o missing bits of Igor's patch

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@782059 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2009-06-05 16:41:07 +00:00
parent 67297ad557
commit f4379a47e8
5 changed files with 13 additions and 36 deletions

View File

@ -146,6 +146,16 @@ public final class ArtifactUtils
return clone; return clone;
} }
/** Returns <code>to</code> collection */
public static <T extends Collection<Artifact>> T copyArtifacts( Collection<Artifact> from, T to )
{
for ( Artifact artifact : from )
{
to.add( ArtifactUtils.copyArtifact( artifact ) );
}
return to;
}
private static <T> List<T> copyList( List<T> original ) private static <T> List<T> copyList( List<T> original )
{ {
List<T> copy = null; List<T> copy = null;

View File

@ -397,12 +397,6 @@ public class DefaultLifecycleExecutor
MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor(
mojoExecution.getGroupId(), mojoExecution.getArtifactId(), mojoExecution.getVersion(), mojoExecution.getGoal(), session.getLocalRepository(), project.getPluginArtifactRepositories() ); mojoExecution.getGroupId(), mojoExecution.getArtifactId(), mojoExecution.getVersion(), mojoExecution.getGoal(), session.getLocalRepository(), project.getPluginArtifactRepositories() );
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
if ( pluginDescriptor.getPlugin().isExtensions() )
{
pluginDescriptor.setClassRealm( pluginManager.getPluginRealm( session, pluginDescriptor ) );
}
requiredDependencyResolutionScope = calculateRequiredDependencyResolutionScope( requiredDependencyResolutionScope, mojoDescriptor.isDependencyResolutionRequired() ); requiredDependencyResolutionScope = calculateRequiredDependencyResolutionScope( requiredDependencyResolutionScope, mojoDescriptor.isDependencyResolutionRequired() );
mojoExecution.setMojoDescriptor( mojoDescriptor ); mojoExecution.setMojoDescriptor( mojoDescriptor );

View File

@ -18,7 +18,6 @@ package org.apache.maven.project.artifact;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -130,7 +129,7 @@ public class DefaultMavenMetadataCache
CacheRecord(Artifact pomArtifact, Set<Artifact> artifacts, List<ArtifactRepository> remoteRepositories) CacheRecord(Artifact pomArtifact, Set<Artifact> artifacts, List<ArtifactRepository> remoteRepositories)
{ {
this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact ); this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact );
this.artifacts = copyArtifacts( artifacts ); this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList<Artifact>() );
this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories ); this.remoteRepositories = new ArrayList<ArtifactRepository>( remoteRepositories );
@ -186,7 +185,7 @@ public class DefaultMavenMetadataCache
if ( cacheRecord != null && !cacheRecord.isStale() ) if ( cacheRecord != null && !cacheRecord.isStale() )
{ {
Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() ); Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() );
Set<Artifact> artifacts = new LinkedHashSet<Artifact>( copyArtifacts( cacheRecord.getArtifacts() ) ); Set<Artifact> artifacts = ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet<Artifact>() );
return new ResolutionGroup( pomArtifact, artifacts , cacheRecord.getRemoteRepositories() ); return new ResolutionGroup( pomArtifact, artifacts , cacheRecord.getRemoteRepositories() );
} }
@ -204,16 +203,6 @@ public class DefaultMavenMetadataCache
cache.put( cacheKey, cacheRecord ); cache.put( cacheKey, cacheRecord );
} }
public static List<Artifact> copyArtifacts( Collection<Artifact> artifacts )
{
ArrayList<Artifact> result = new ArrayList<Artifact>();
for ( Artifact artifact : artifacts )
{
result.add( ArtifactUtils.copyArtifact( artifact ) );
}
return result;
}
public void flush() public void flush()
{ {
cache.clear(); cache.clear();

View File

@ -155,22 +155,6 @@ public abstract class AbstractCoreMavenComponentTestCase
return repositorySystem.createDefaultLocalRepository(); return repositorySystem.createDefaultLocalRepository();
} }
protected ArtifactRepository getReactorRepository( MavenProject... projects )
throws InvalidRepositoryException
{
Map<String, MavenProject> projectsMap = new LinkedHashMap<String, MavenProject>();
for ( MavenProject project : projects )
{
projectsMap.put( ArtifactUtils.key( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
}
DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = new DelegatingLocalArtifactRepository( getLocalRepository() );
delegatingLocalArtifactRepository.setBuildReactor( new ReactorArtifactRepository( projectsMap ) );
return delegatingLocalArtifactRepository;
}
protected class ProjectBuilder protected class ProjectBuilder
{ {
private MavenProject project; private MavenProject project;

View File

@ -52,7 +52,7 @@ under the License.
<easyMockVersion>1.2_Java1.3</easyMockVersion> <easyMockVersion>1.2_Java1.3</easyMockVersion>
<junitVersion>3.8.2</junitVersion> <junitVersion>3.8.2</junitVersion>
<plexusVersion>1.0-beta-3.0.8-SNAPSHOT</plexusVersion> <plexusVersion>1.0-beta-3.0.8-SNAPSHOT</plexusVersion>
<plexusInterpolationVersion>1.8.1</plexusInterpolationVersion> <plexusInterpolationVersion>1.9-SNAPSHOT</plexusInterpolationVersion>
<plexusPluginManagerVersion>1.0-alpha-1</plexusPluginManagerVersion> <plexusPluginManagerVersion>1.0-alpha-1</plexusPluginManagerVersion>
<plexusUtilsVersion>1.5.13-SNAPSHOT</plexusUtilsVersion> <plexusUtilsVersion>1.5.13-SNAPSHOT</plexusUtilsVersion>
<plexusJetty6Version>1.6</plexusJetty6Version> <plexusJetty6Version>1.6</plexusJetty6Version>