You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2011/11/28 02:33:07 UTC
svn commit: r1206958 - in /buildr/trunk: CHANGELOG lib/buildr/java/pom.rb
spec/java/pom_spec.rb
Author: boisvert
Date: Mon Nov 28 01:33:06 2011
New Revision: 1206958
URL: http://svn.apache.org/viewvc?rev=1206958&view=rev
Log:
BUILDR-617 pom exclusion does not work (Kafka Liu)
Added:
buildr/trunk/spec/java/pom_spec.rb
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/java/pom.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1206958&r1=1206957&r2=1206958&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Mon Nov 28 01:33:06 2011
@@ -1,3 +1,6 @@
+1.4.8 (Pending)
+* Fixed: BUILDR-617 pom exclusion does not work (Kafka Liu)
+
1.4.7 (2011-11-17)
* Added: Add a Findbugs extension.
* Added: Add a Checkstyle extension.
Modified: buildr/trunk/lib/buildr/java/pom.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/pom.rb?rev=1206958&r1=1206957&r2=1206958&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/pom.rb (original)
+++ buildr/trunk/lib/buildr/java/pom.rb Mon Nov 28 01:33:06 2011
@@ -103,10 +103,10 @@ module Buildr
if options[:scopes].include?(spec[:scope])
spec.delete(:scope)
- exclusions = dep["exclusions"]["exclusion"] rescue nil
+ 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("#{dep['groupdId'].first}:#{dep['artifactId'].first}:") == 0}
+ exclusions.find {|ex| dep.index("#{ex['groupId'].first}:#{ex['artifactId'].first}:") == 0}
} if exclusions
[Artifact.to_spec(spec)] + transitive_deps
Added: buildr/trunk/spec/java/pom_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/pom_spec.rb?rev=1206958&view=auto
==============================================================================
--- buildr/trunk/spec/java/pom_spec.rb (added)
+++ buildr/trunk/spec/java/pom_spec.rb Mon Nov 28 01:33:06 2011
@@ -0,0 +1,70 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership. The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
+require 'fileutils'
+
+describe Buildr::POM do
+ before do
+ repositories.remote = 'http://example.com'
+ @app = 'group:app:jar:1.0'
+ write artifact(@app).pom.to_s, <<-XML
+<project>
+ <artifactId>app</artifactId>
+ <groupId>group</groupId>
+ <dependencies>
+ <dependency>
+ <artifactId>library</artifactId>
+ <groupId>org.example</groupId>
+ <version>1.1</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.mail</groupId>
+ <artifactId>mail</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
+XML
+ @library = 'org.example:library:jar:1.1'
+ write artifact(@library).pom.to_s, <<-XML
+<project>
+ <artifactId>app</artifactId>
+ <groupId>group</groupId>
+ <dependencies>
+ <dependency>
+ <artifactId>mail</artifactId>
+ <groupId>javax.mail</groupId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <artifactId>foo</artifactId>
+ <groupId>org.example</groupId>
+ <version>2.0</version>
+ </dependency>
+ </dependencies>
+</project>
+XML
+ end
+
+ it 'should return a list of artifacts from all its arguments' do
+ pom = POM.load(artifact(@app).pom)
+ specs = [ 'org.example:library:jar:1.1', 'org.example:foo:jar:2.0' ]
+ pom.dependencies.should eql(specs)
+ end
+end
+