Skip to content

Instantly share code, notes, and snippets.

@achin
Created February 4, 2014 14:47
Show Gist options
  • Save achin/8804878 to your computer and use it in GitHub Desktop.
Save achin/8804878 to your computer and use it in GitHub Desktop.
function mvn_eval () {
local pom="$1"
local expression="$2"
mvn help:evaluate -f "${pom}" -Dexpression="${expression}" | grep -Ev '^\[INFO\]|\[WARNING\]'
}
function parent_url () {
local pom="$1"
local repository="$2"
local group=$(mvn_eval ${pom} project.groupId | sed -e 's/\./\//g')
local artifact=$(mvn_eval ${pom} project.artifactId)
local version=$(mvn_eval ${pom} project.version)
echo "${repository}/${group}/${artifact}/${version}"
}
function delete_artifacts () {
local pom="$1"
local repository="$2"
local user="$3"
local password="$4"
echo curl -X DELETE -u "${user}:${password}" $(parent_url ${pom} ${repository})
}
function delete_all_artifacts () {
local base_dir="$1"
local repository="$2"
local user="$3"
local password="$4"
for pom in $(find ${base_dir} -name pom.xml)
do
delete_artifacts ${pom} ${repository} ${user} ${password}
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment