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/05/20 16:55:44 UTC
svn commit: r1125423 - in /buildr/trunk: CHANGELOG
lib/buildr/packaging/artifact.rb spec/packaging/artifact_spec.rb
Author: boisvert
Date: Fri May 20 14:55:44 2011
New Revision: 1125423
URL: http://svn.apache.org/viewvc?rev=1125423&view=rev
Log:
BUILDR-251 Classifier not handled when downloading snapshot artifacts (Ryan Fowler)
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/packaging/artifact.rb
buildr/trunk/spec/packaging/artifact_spec.rb
Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1125423&r1=1125422&r2=1125423&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri May 20 14:55:44 2011
@@ -10,6 +10,7 @@
* Fixed: BUILDR-571 Generated IDEA projects include resources multiple times (Peter Royal)
* Fixed: BUILDR-573 HTTP upload PUT request with incorrect Content-Type (Mathias Doenitz)
* Fixed: BUILDR-578 Tar task does not preserve uid/gid on folders (Jean-Philippe Caruana)
+* Fixed: BUILDR-251 Classifier not handled when downloading snapshot artifacts (Ryan Fowler)
1.4.5 (2011-02-20)
* Added: BUILDR-555 Add support for the jaxb binding compiler (Mark Petrovic)
Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=1125423&r1=1125422&r2=1125423&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Fri May 20 14:55:44 2011
@@ -477,7 +477,8 @@ module Buildr
error "No build number provided for the snapshot #{to_spec}" if build_number.nil?
return nil if timestamp.nil? || build_number.nil?
snapshot_of = version[0, version.size - 9]
- repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp.text}-#{build_number.text}.#{type}"
+ classifier_snippet = (classifier != nil) ? "-#{classifier}" : ""
+ repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp.text}-#{build_number.text}#{classifier_snippet}.#{type}"
rescue URI::NotFoundError
nil
end
Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=1125423&r1=1125422&r2=1125423&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Fri May 20 14:55:44 2011
@@ -300,6 +300,32 @@ describe Repositories, 'remote' do
should change { File.exist?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT.jar')) }.to(true)
end
+ it 'should resolve m2-style deployed snapshots with classifiers' do
+ metadata = <<-XML
+ <?xml version='1.0' encoding='UTF-8'?>
+ <metadata>
+ <groupId>com.example</groupId>
+ <artifactId>library</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20071012.190008</timestamp>
+ <buildNumber>8</buildNumber>
+ </snapshot>
+ <lastUpdated>20071012190008</lastUpdated>
+ </versioning>
+ </metadata>
+ XML
+ repositories.remote = 'http://example.com'
+ URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/library-2.1-20071012.190008-8-classifier.jar$/), anything()).
+ and_return { |uri, target, options| write target }
+ URI.should_receive(:download).once.with(uri(/2.1-SNAPSHOT\/maven-metadata.xml$/), duck_type(:write)).
+ and_return { |uri, target, options| target.write(metadata) }
+ puts repositories.local
+ lambda { artifact('com.example:library:jar:classifier:2.1-SNAPSHOT').invoke}.
+ should change {File.exists?(File.join(repositories.local, 'com/example/library/2.1-SNAPSHOT/library-2.1-SNAPSHOT-classifier.jar')) }.to(true)
+ end
+
it 'should fail resolving m2-style deployed snapshots if a timestamp is missing' do
metadata = <<-XML
<?xml version='1.0' encoding='UTF-8'?>