You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2009/09/26 00:16:26 UTC
svn commit: r819047 - in /maven/plugins/trunk/maven-eclipse-plugin/src:
main/java/org/apache/maven/plugin/ide/
test/java/org/apache/maven/plugin/eclipse/it/
test/resources/projects/project-56-MECLIPSE-603/
test/resources/projects/project-56-MECLIPSE-60...
Author: aheritier
Date: Fri Sep 25 22:16:25 2009
New Revision: 819047
URL: http://svn.apache.org/viewvc?rev=819047&view=rev
Log:
CLOSED - issue MECLIPSE-603: Exclusions are not applied on transitive dependencies
http://jira.codehaus.org/browse/MECLIPSE-603
Patch from Stephane Landelle applied with few modifications
Added:
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml (with props)
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/
maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt (with props)
Modified:
maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/ide/AbstractIdeSupportMojo.java?rev=819047&r1=819046&r2=819047&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 Fri Sep 25 22:16:25 2009
@@ -781,16 +781,7 @@
art.setFile( new File( dependency.getSystemPath() ) );
}
- List exclusions = new ArrayList();
- for ( Iterator j = dependency.getExclusions().iterator(); j.hasNext(); )
- {
- Exclusion e = (Exclusion) j.next();
- exclusions.add( e.getGroupId() + ":" + e.getArtifactId() ); //$NON-NLS-1$
- }
-
- ArtifactFilter newFilter = new ExcludesArtifactFilter( exclusions );
-
- art.setDependencyFilter( newFilter );
+ handleExclusions( art, dependency );
artifacts.add( art );
}
@@ -799,6 +790,27 @@
}
/**
+ * Apply exclusion filters to direct AND transitive dependencies.
+ *
+ * @param artifact
+ * @param dependency
+ */
+ private void handleExclusions( Artifact artifact, Dependency dependency )
+ {
+
+ List exclusions = new ArrayList();
+ for ( Iterator j = dependency.getExclusions().iterator(); j.hasNext(); )
+ {
+ Exclusion e = (Exclusion) j.next();
+ exclusions.add( e.getGroupId() + ":" + e.getArtifactId() ); //$NON-NLS-1$
+ }
+
+ ArtifactFilter newFilter = new ExcludesArtifactFilter( exclusions );
+
+ artifact.setDependencyFilter( newFilter );
+ }
+
+ /**
* Utility method that locates a project producing the given artifact.
*
* @param artifact the artifact a project should produce.
@@ -845,7 +857,7 @@
}
/**
- * @return an array with all dependencies avalaible in the workspace, to be implemented by the subclasses.
+ * @return an array with all dependencies available in the workspace, to be implemented by the subclasses.
*/
protected IdeDependency[] getWorkspaceArtefacts()
{
@@ -871,6 +883,8 @@
artifactFactory.createDependencyArtifact( d.getGroupId(), d.getArtifactId(), versionRange,
d.getType(), d.getClassifier(), d.getScope(),
d.isOptional() );
+
+ handleExclusions( artifact, d );
map.put( d.getManagementKey(), artifact );
}
catch ( InvalidVersionSpecificationException e )
Modified: maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java?rev=819047&r1=819046&r2=819047&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/java/org/apache/maven/plugin/eclipse/it/EclipsePluginIT.java Fri Sep 25 22:16:25 2009
@@ -19,18 +19,12 @@
package org.apache.maven.plugin.eclipse.it;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.eclipse.TempEclipseWorkspace;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
-import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
@@ -666,6 +660,17 @@
testProject( "project-55-MECLIPSE-178" );
}
+ /**
+ * [MECLIPSE-603] checks exclusions on direct and transitive dependencies
+ *
+ * @throws Exception
+ */
+ public void testProject56()
+ throws Exception
+ {
+ testProject( "project-56-MECLIPSE-603" );
+ }
+
public void testJeeSimple()
throws Exception
{
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath?rev=819047&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath Fri Sep 25 22:16:25 2009
@@ -0,0 +1,23 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/ejb3-persistence/1.0.2.GA/ejb3-persistence-1.0.2.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.4.0.GA/hibernate-annotations-3.4.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.3.0.ga/hibernate-commons-annotations-3.3.0.ga.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.0.SP1/hibernate-core-3.3.0.SP1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jaxen/jaxen/1.1-beta-6/jaxen-1.1-beta-6.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jaxme/jaxme-api/0.3/jaxme-api-0.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/pull-parser/pull-parser/2/pull-parser-2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/msv/relaxngDatatype/20030807/relaxngDatatype-20030807.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.4.2/slf4j-api-1.4.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0/stax-api-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/xpp3/xpp3/1.1.3.3/xpp3-1.1.3.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/msv/xsdlib/20030807/xsdlib-20030807.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.classpath
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project?rev=819047&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project Fri Sep 25 22:16:25 2009
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>maven-eclipse-plugin-test-project-56</name>
+ <comment>Project-56 - Test MECLIPSE-603</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/expected/.project
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml?rev=819047&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml Fri Sep 25 22:16:25 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>eclipse</groupId>
+ <artifactId>maven-eclipse-plugin-test-project-56</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Project-56 - Test MECLIPSE-603</name>
+ <description>Project-56 - Test MECLIPSE-603</description>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>test</version>
+ <configuration>
+ <workspace>${basedir}/../../eclipse/workspaceDoesNotExist</workspace>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.4.0.GA</version>
+ </dependency>
+ </dependencies>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-commons-annotations</artifactId>
+ <version>3.3.0.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+</project>
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/pom.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt?rev=819047&view=auto
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt (added)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt Fri Sep 25 22:16:25 2009
@@ -0,0 +1,7 @@
+/**
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @version $Id$
+ */
+public class DummyClass
+{
+}
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/trunk/maven-eclipse-plugin/src/test/resources/projects/project-56-MECLIPSE-603/src/main/java/DummyClass.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision