diff --git a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactUtils.java b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactUtils.java index be870065ea..ec9a5e5e77 100644 --- a/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactUtils.java +++ b/maven-compat/src/main/java/org/apache/maven/artifact/ArtifactUtils.java @@ -146,6 +146,16 @@ public final class ArtifactUtils return clone; } + /** Returns to collection */ + public static > T copyArtifacts( Collection from, T to ) + { + for ( Artifact artifact : from ) + { + to.add( ArtifactUtils.copyArtifact( artifact ) ); + } + return to; + } + private static List copyList( List original ) { List copy = null; diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index a88f57eef2..9aea3f885c 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -397,12 +397,6 @@ public class DefaultLifecycleExecutor MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( 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() ); mojoExecution.setMojoDescriptor( mojoDescriptor ); diff --git a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java index 5108008d0e..6a73a3fb66 100644 --- a/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java +++ b/maven-core/src/main/java/org/apache/maven/project/artifact/DefaultMavenMetadataCache.java @@ -18,7 +18,6 @@ package org.apache.maven.project.artifact; import java.io.File; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashSet; import java.util.List; @@ -130,7 +129,7 @@ public class DefaultMavenMetadataCache CacheRecord(Artifact pomArtifact, Set artifacts, List remoteRepositories) { this.pomArtifact = ArtifactUtils.copyArtifact( pomArtifact ); - this.artifacts = copyArtifacts( artifacts ); + this.artifacts = ArtifactUtils.copyArtifacts( artifacts, new ArrayList() ); this.remoteRepositories = new ArrayList( remoteRepositories ); @@ -186,7 +185,7 @@ public class DefaultMavenMetadataCache if ( cacheRecord != null && !cacheRecord.isStale() ) { Artifact pomArtifact = ArtifactUtils.copyArtifact( cacheRecord.getArtifact() ); - Set artifacts = new LinkedHashSet( copyArtifacts( cacheRecord.getArtifacts() ) ); + Set artifacts = ArtifactUtils.copyArtifacts( cacheRecord.getArtifacts(), new LinkedHashSet() ); return new ResolutionGroup( pomArtifact, artifacts , cacheRecord.getRemoteRepositories() ); } @@ -204,16 +203,6 @@ public class DefaultMavenMetadataCache cache.put( cacheKey, cacheRecord ); } - public static List copyArtifacts( Collection artifacts ) - { - ArrayList result = new ArrayList(); - for ( Artifact artifact : artifacts ) - { - result.add( ArtifactUtils.copyArtifact( artifact ) ); - } - return result; - } - public void flush() { cache.clear(); diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java index 112011fad1..7328a4fd15 100644 --- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java @@ -154,22 +154,6 @@ public abstract class AbstractCoreMavenComponentTestCase { return repositorySystem.createDefaultLocalRepository(); } - - protected ArtifactRepository getReactorRepository( MavenProject... projects ) - throws InvalidRepositoryException - { - Map projectsMap = new LinkedHashMap(); - - 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 { diff --git a/pom.xml b/pom.xml index 74b33436be..a2ca8c46c7 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ under the License. 1.2_Java1.3 3.8.2 1.0-beta-3.0.8-SNAPSHOT - 1.8.1 + 1.9-SNAPSHOT 1.0-alpha-1 1.5.13-SNAPSHOT 1.6