Skip to content

Instantly share code, notes, and snippets.

@leobessa
Created November 27, 2019 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leobessa/45841dfd634e72d5b181a33520d461c2 to your computer and use it in GitHub Desktop.
Save leobessa/45841dfd634e72d5b181a33520d461c2 to your computer and use it in GitHub Desktop.
Script for mvn install:install-file for jars in directory
Dir["./**/*.jar"].map do |f|
group_dir, artifact_id, version, file_name = f.reverse.split("/", 4).map(&:reverse).reverse
path = File.absolute_path f
group_id = group_dir.sub("./","").gsub("/",".")
packaging = "jar"
pom_path = path.sub /\.[^.]+\z/, ".pom"
"mvn install:install-file -Dfile=#{path} -DgroupId=#{group_id} -DartifactId=#{artifact_id} -Dversion=#{version} -Dpackaging=#{packaging} -DpomFile=#{pom_path} -DcreateChecksum=true"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment