Repository: buildr
Updated Branches:
refs/heads/master 537d1c0bb -> 2d716e04c
BUILDR-695 transitive doesn't support ${project.parent.version} in POM.
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/2d716e04
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/2d716e04
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/2d716e04
Branch: refs/heads/master
Commit: 2d716e04cf7fc8fb594d2d2396ed88db5f672a7b
Parents: 537d1c0
Author: Antoine Toulme <[email protected]>
Authored: Thu Jun 16 00:21:32 2016 -0700
Committer: Antoine Toulme <[email protected]>
Committed: Thu Jun 16 00:21:39 2016 -0700
----------------------------------------------------------------------
CHANGELOG | 1 +
lib/buildr/java/pom.rb | 5 +++++
spec/java/pom_spec.rb | 37 +++++++++++++++++++++++++++++++++++++
3 files changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/2d716e04/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index c320512..6d2c13d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -15,6 +15,7 @@
* Fixed: BUILDR-674 Artifacts with bundle extension cannot be downloaded by
Buildr
* Fixed: BUILDR-565 resources are not included in the war if defined after
package call
* Fixed: BUILDR-621 ZipTask creates zip file with entries not sorted by path
causing very slow unzipping.
+* Fixed: BUILDR-695 transitive doesn't support ${project.parent.version} in
POM.
* Change: Update the custom_pom addon to generate poms with exclusions section
that excludes
all transitive dependencies. This is required as buildr dependencies
are not
transitive while Maven's dependencies are transitive by default.
http://git-wip-us.apache.org/repos/asf/buildr/blob/2d716e04/lib/buildr/java/pom.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/pom.rb b/lib/buildr/java/pom.rb
index e91c232..776660a 100644
--- a/lib/buildr/java/pom.rb
+++ b/lib/buildr/java/pom.rb
@@ -129,6 +129,11 @@ module Buildr
hash[key] = hash["pom.#{key}"] = hash["project.#{key}"] =
value_of(value) if value
hash
}
+ pom = %w(groupId artifactId version).inject(pom) { |hash, key|
+ value = parent.project[key]
+ hash[key] = hash["pom.parent.#{key}"] =
hash["project.parent.#{key}"] = value_of(value) if value
+ hash
+ } if parent
props = project['properties'].first rescue {}
props = props.inject({}) { |mapped, pair| mapped[pair.first] =
value_of(pair.last, props) ; mapped }
(parent ? parent.properties.merge(props) : props).merge(pom)
http://git-wip-us.apache.org/repos/asf/buildr/blob/2d716e04/spec/java/pom_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/pom_spec.rb b/spec/java/pom_spec.rb
index 92367c6..6fffe97 100644
--- a/spec/java/pom_spec.rb
+++ b/spec/java/pom_spec.rb
@@ -123,3 +123,40 @@ XML
pom.properties.should eql(specs)
end
end
+
+describe Buildr::POM do
+ before do
+ repositories.remote = 'http://buildr.apache.org/repository/noexist'
+ @parent = 'group:app-parent:jar:1.1.1'
+ write artifact(@parent).pom.to_s, <<-XML
+<project>
+ <artifactId>app-parent</artifactId>
+ <groupId>group</groupId>
+ <version>1.1.1</version>
+</project>
+XML
+ @app = 'group:app:jar:1.0'
+ write artifact(@app).pom.to_s, <<-XML
+<project>
+ <artifactId>app</artifactId>
+ <groupId>group</groupId>
+ <parent>
+ <groupId>group</groupId>
+ <artifactId>app-parent</artifactId>
+ <version>1.1.1</version>
+ </parent>
+ <dependencies>
+ <dependency>
+ <artifactId>library</artifactId>
+ <groupId>org.example</groupId>
+ <version>${project.parent.version}</version>
+ </dependency>
+ </dependencies>
+</project>
+XML
+ end
+ it "should manage to resolve the version from the parent version" do
+ pom = POM.load(artifact(@app).pom)
+ pom.dependencies.should include('org.example:library:jar:1.1.1')
+ end
+end