Answers:
基于Apache Buildr代码:http : //svn.apache.org/repos/asf/buildr/trunk/lib/buildr/packaging/artifact.rb
您可以执行以下操作:
def snapshot?
version =~ /-SNAPSHOT$/
end
if snapshot?
metadata_path = "#{group_path}/#{id}/#{version}/maven-metadata.xml"
metadata_xml = StringIO.new
URI.download repo_url + metadata_path, metadata_xml
metadata = REXML::Document.new(metadata_xml.string).root
timestamp = REXML::XPath.first(metadata, '//timestamp')
build_number = REXML::XPath.first(metadata, '//buildNumber')
snapshot_of = version[0, version.size - 9]
classifier_snippet = (classifier != nil) ? "-#{classifier}" : ""
repo_url + "#{group_path}/#{id}/#{version}/#{id}-#{snapshot_of}-#{timestamp.text}-#{build_number.text}#{classifier_snippet}.#{type}"
end