You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/05/23 11:17:55 UTC

svn commit: r1341804 - in /buildr/trunk: CHANGELOG lib/buildr/java/pom.rb spec/java/pom_spec.rb

Author: donaldp
Date: Wed May 23 09:17:55 2012
New Revision: 1341804

URL: http://svn.apache.org/viewvc?rev=1341804&view=rev
Log:
BUILDR-618 - pom properties feature does not support hierarchy

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/java/pom.rb
    buildr/trunk/spec/java/pom_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1341804&r1=1341803&r2=1341804&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Wed May 23 09:17:55 2012
@@ -1,4 +1,5 @@
 1.4.7 (2012-05-19)
+* Added:  BUILDR-618 pom properties feature does not support hierarchy (kafka liu)
 * Added:  Add a Sonar extension.
 * Change: BUILDR-638 Update to rake 0.9.2.2 (Russell Teabeault)
 * Added:  BUILDR-316 Add a GWT extension

Modified: buildr/trunk/lib/buildr/java/pom.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/pom.rb?rev=1341804&r1=1341803&r2=1341804&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/pom.rb (original)
+++ buildr/trunk/lib/buildr/java/pom.rb Wed May 23 09:17:55 2012
@@ -130,7 +130,7 @@ module Buildr
           hash
         }
         props = project["properties"].first rescue {}
-        props = props.inject({}) { |mapped, pair| mapped[pair.first] = value_of(pair.last, pom) ; mapped }
+        props = props.inject({}) { |mapped, pair| mapped[pair.first] = value_of(pair.last, props) ; mapped }
         (parent ? parent.properties.merge(props) : props).merge(pom)
       end
     end

Modified: buildr/trunk/spec/java/pom_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/pom_spec.rb?rev=1341804&r1=1341803&r2=1341804&view=diff
==============================================================================
--- buildr/trunk/spec/java/pom_spec.rb (original)
+++ buildr/trunk/spec/java/pom_spec.rb Wed May 23 09:17:55 2012
@@ -68,3 +68,58 @@ XML
   end
 end
 
+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>
+  <properties>
+    <a.version>${b.version}</a.version>
+    <b.version>1.1</b.version>
+  </properties>
+  <artifactId>app</artifactId>
+  <groupId>group</groupId>
+  <dependencies>
+    <dependency>
+      <artifactId>library</artifactId>
+      <groupId>org.example</groupId>
+      <version>${a.version}</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 respect exclusions when computing transitive dependencies when the pom includes properties' do
+    pom = POM.load(artifact(@app).pom)
+    specs = {"a.version"=>"1.1", "b.version"=>"1.1", "project.groupId"=>"group", "pom.groupId"=>"group", "groupId"=>"group", "project.artifactId"=>"app", "pom.artifactId"=>"app", "artifactId"=>"app"}
+    pom.properties.should eql(specs)
+  end
+end
\ No newline at end of file