You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/04/02 09:47:02 UTC
svn commit: r390796 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
main/resources/org/apache/maven/plugin/ide/messages.properties
test/projects/master-test/module-2/pom.xml
Author: fgiust
Date: Sat Apr 1 23:47:01 2006
New Revision: 390796
URL: http://svn.apache.org/viewcvs?rev=390796&view=rev
Log:
MECLIPSE-86 Dependencies of type test-jar get added twice (for referenced reactor projects)
fix and testcase added
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/master-test/module-2/pom.xml
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=390796&r1=390795&r2=390796&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java Sat Apr 1 23:47:01 2006
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -434,6 +435,9 @@
e.getGroupId(), e.getArtifactId(), e.getVersion(), e.getMessage() } ) );
}
+ // keep track of added reactor projects in order to avoid duplicates
+ Set emittedReactorProjectId = new HashSet();
+
for ( Iterator i = artifactResolutionResult.getArtifactResolutionNodes().iterator(); i.hasNext(); )
{
ResolutionNode node = (ResolutionNode) i.next();
@@ -469,14 +473,18 @@
}
}
- IdeDependency dep = new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
- isReactorProject, Artifact.SCOPE_TEST.equals( art.getScope() ),
- Artifact.SCOPE_SYSTEM.equals( art.getScope() ),
- Artifact.SCOPE_PROVIDED.equals( art.getScope() ), art
- .getArtifactHandler().isAddedToClasspath(), art.getFile(),
- art.getType() );
+ if ( !isReactorProject || emittedReactorProjectId.add( art.getGroupId() + '-' + art.getArtifactId() ) )
+ {
- dependencyList.add( dep );
+ IdeDependency dep = new IdeDependency( art.getGroupId(), art.getArtifactId(), art.getVersion(),
+ isReactorProject, Artifact.SCOPE_TEST
+ .equals( art.getScope() ), Artifact.SCOPE_SYSTEM
+ .equals( art.getScope() ), Artifact.SCOPE_PROVIDED
+ .equals( art.getScope() ), art.getArtifactHandler()
+ .isAddedToClasspath(), art.getFile(), art.getType() );
+
+ dependencyList.add( dep );
+ }
}
@@ -558,10 +566,7 @@
MavenProject reactorProject = (MavenProject) iter.next();
if ( reactorProject.getGroupId().equals( artifact.getGroupId() )
- && reactorProject.getArtifactId().equals( artifact.getArtifactId() )
- && reactorProject.getPackaging().equals( artifact.getType() )
-
- )
+ && reactorProject.getArtifactId().equals( artifact.getArtifactId() ) )
{
if ( reactorProject.getVersion().equals( artifact.getVersion() ) )
{
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties?rev=390796&r1=390795&r2=390796&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/ide/messages.properties Sat Apr 1 23:47:01 2006
@@ -2,7 +2,7 @@
sourcesnotdownloaded=\n Sources for some artifacts are not available.\n Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources.\n List of artifacts without a source archive:
sourcesmissingitem=\n o {0}
errorresolving=Error resolving {0} artifact. Artifact id: {1} (Message: {2})
-artifactresolution=An error occurred during dependency resolution of the following artifact:\n\n {0}:{1}:{2}\n\nCaused by: {3}
-artifactdownload=An error occurred during dependency resolution.\n\n Failed to retrieve {0}\nCaused by: {1}
+artifactresolution=An error occurred during dependency resolution of the following artifact:\n {0}:{1}:{2}\nCaused by: {3}
+artifactdownload=An error occurred during dependency resolution.\n Failed to retrieve {0}:{1}-{2}\nCaused by: {3}
cantcanonicalize=Can''t canonicalize system path: {0}
unabletoparseversion={0}: unable to parse version ''{1}'' for dependency ''{2}'': {3}
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/master-test/module-2/pom.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/master-test/module-2/pom.xml?rev=390796&r1=390795&r2=390796&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/master-test/module-2/pom.xml (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/projects/master-test/module-2/pom.xml Sat Apr 1 23:47:01 2006
@@ -15,6 +15,14 @@
<version>1.0</version>
</dependency>
<dependency>
+ <!-- module -->
+ <groupId>eclipsetest</groupId>
+ <artifactId>module-1</artifactId>
+ <version>1.0</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>eclipsetest</groupId>
<artifactId>direct-compile</artifactId>
<version>1.0</version>