You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by dk...@apache.org on 2008/07/16 18:18:58 UTC
svn commit: r677325 -
/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Author: dkulp
Date: Wed Jul 16 09:18:57 2008
New Revision: 677325
URL: http://svn.apache.org/viewvc?rev=677325&view=rev
Log:
Possible fix for too many excludes when using maven <= 2.0.7
Modified:
maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Modified: maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java?rev=677325&r1=677324&r2=677325&view=diff
==============================================================================
--- maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java (original)
+++ maven/plugins/trunk/maven-shade-plugin/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java Wed Jul 16 09:18:57 2008
@@ -807,23 +807,42 @@
while ( it2.hasNext() )
{
DependencyNode n3 = (DependencyNode) it2.next();
- //anything two levels deep that is not marked "included"
+ //anything two levels deep that is marked "included"
//is stuff that was excluded by the original poms, make sure it
//remains excluded
if ( n3.getState() == DependencyNode.INCLUDED)
{
+ //check if it really isn't in the list of direct dependencies. Maven
+ //prior to 2.0.8 may grab versions from transients instead of
+ //from the direct deps in which case they would be marked included
+ //instead of OMITTED_FOR_DUPLICATE
+ boolean found = false;
for ( int x = 0; x < dependencies.size(); x++ )
{
Dependency dep = (Dependency) dependencies.get( x );
- if ( dep.getArtifactId().equals( n2.getArtifact().getArtifactId() )
- && dep.getGroupId().equals( n2.getArtifact().getGroupId() ) )
+ if ( dep.getArtifactId().equals( n3.getArtifact().getArtifactId() )
+ && dep.getGroupId().equals( n3.getArtifact().getGroupId() ) )
{
- Exclusion exclusion = new Exclusion();
- exclusion.setArtifactId( n3.getArtifact().getArtifactId() );
- exclusion.setGroupId( n3.getArtifact().getGroupId() );
- dep.addExclusion( exclusion );
- modified = true;
- break;
+ found = true;
+ }
+
+ }
+
+ if ( !found )
+ {
+ for ( int x = 0; x < dependencies.size(); x++ )
+ {
+ Dependency dep = (Dependency) dependencies.get( x );
+ if ( dep.getArtifactId().equals( n2.getArtifact().getArtifactId() )
+ && dep.getGroupId().equals( n2.getArtifact().getGroupId() ) )
+ {
+ Exclusion exclusion = new Exclusion();
+ exclusion.setArtifactId( n3.getArtifact().getArtifactId() );
+ exclusion.setGroupId( n3.getArtifact().getGroupId() );
+ dep.addExclusion( exclusion );
+ modified = true;
+ break;
+ }
}
}
}