You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/06/08 19:20:33 UTC

svn commit: r952738 - /maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java

Author: bentmann
Date: Tue Jun  8 17:20:32 2010
New Revision: 952738

URL: http://svn.apache.org/viewvc?rev=952738&view=rev
Log:
o Fixed mojo to not use single artifact instance in two different contexts

Modified:
    maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java

Modified: maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java
URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java?rev=952738&r1=952737&r2=952738&view=diff
==============================================================================
--- maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java (original)
+++ maven/core-integration-testing/trunk/core-it-support/core-it-plugins/maven-it-plugin-dependency-resolution/src/main/java/org/apache/maven/plugin/coreit/InjectMojo.java Tue Jun  8 17:20:32 2010
@@ -26,6 +26,7 @@ import java.util.LinkedHashSet;
 import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.factory.ArtifactFactory;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -66,6 +67,13 @@ public class InjectMojo
     private MavenProject project;
 
     /**
+     * The artifact factory.
+     * 
+     * @component
+     */
+    private ArtifactFactory factory;
+
+    /**
      * Runs this mojo.
      * 
      * @throws MojoExecutionException If an error occured.
@@ -99,6 +107,9 @@ public class InjectMojo
 
             if ( artifactKeys.remove( artifactKey ) )
             {
+                artifact = factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), 
+                    artifact.getVersion(), Artifact.SCOPE_COMPILE, artifact.getType() );
+
                 getLog().info( "[MAVEN-CORE-IT-LOG] Injecting dependency artifact " + artifact );
 
                 dependencyArtifacts.add( artifact );