Copy artifacts from one Maven repository to another
#!/usr/bin/env ruby | |
require 'fileutils' | |
# Run this form the directory that is being uploaded. | |
# It will delete the file as it goes | |
USER='user' | |
PASSWORD='password' | |
REPO='repo.example.com/repository/thirdparty' | |
`find * -type f ! -name run.rb ! -name '*.md5' ! -name '*.sha1' ! -name 'maven-metadata.xml' ! -name '*.asc' ! -name 'archetype-catalog.xml'`.split("\n").each do |f| | |
puts "Uploading #{f}" | |
command = "curl --fail -X PUT http://#{USER}:#{PASSWORD}@#{REPO}/#{f} --upload-file #{f}" | |
puts command | |
system(command) | |
if $?.exitstatus == 0 | |
puts "Completed upload of #{f}" | |
FileUtils.rm_f f | |
else | |
puts "Failed to upload #{f}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment