Author: donaldp
Date: Tue Dec 11 19:18:40 2012
New Revision: 1420335

URL: http://svn.apache.org/viewvc?rev=1420335&view=rev
Log:
Update the POM dependency traversal code so that;
* excluded dependencies do not get traversed and then excluded but are excluded 
prior to loading the dependencies POM file
* inability to load a dependencies POM does not result in failure but it is 
assumed that the dependency does not have a POM

Modified:
    buildr/trunk/lib/buildr/java/pom.rb

Modified: buildr/trunk/lib/buildr/java/pom.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/pom.rb?rev=1420335&r1=1420334&r2=1420335&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/pom.rb (original)
+++ buildr/trunk/lib/buildr/java/pom.rb Tue Dec 11 19:18:40 2012
@@ -99,15 +99,14 @@ module Buildr
             apply = managed(spec)
             spec = apply.merge(spec) if apply
 
+            next if options[:exclusions] && options[:exclusions].any? { |ex| 
dep['groupId'] == ex['groupId'] && dep['artifactId'] == ex['artifactId'] }
+
             # calculate transitive dependencies
             if options[:scopes].include?(spec[:scope])
               spec.delete(:scope)
 
               exclusions = dep["exclusions"].first["exclusion"] rescue nil
-              transitive_deps = 
POM.load(spec).dependencies(options[:scopes_transitive] || SCOPES_TRANSITIVE)
-              transitive_deps = transitive_deps.reject{|dep|
-                exclusions.find {|ex| 
dep.index("#{ex['groupId'].first}:#{ex['artifactId'].first}:") == 0}
-              } if exclusions
+              transitive_deps = POM.load(spec).dependencies(:exclusions => 
exclusions, :scopes => (options[:scopes_transitive] || SCOPES_TRANSITIVE) ) 
rescue []
 
               [Artifact.to_spec(spec)] + transitive_deps
             end


Reply via email to