Skip to content

Instantly share code, notes, and snippets.

@bsorrentino
Last active April 24, 2019 21:10
Show Gist options
  • Select an option

  • Save bsorrentino/5e9ed1a976c9fd5303e0 to your computer and use it in GitHub Desktop.

Select an option

Save bsorrentino/5e9ed1a976c9fd5303e0 to your computer and use it in GitHub Desktop.
Remove all artifacts related to a maven project
clear
echo -n "clear project's targets"
mvn -o clean
echo -n "delete project's artifacts from local repo [y/N]"
read -n 1 del
#echo "$del"
if [ "$del" == "y" ] ; then
echo -e "\nperform delete "
mvn $@ -fn -T2 -o \
org.codehaus.mojo:build-helper-maven-plugin:3.0.0:remove-project-artifact \
-Dbuildhelper.failOnError=false \
-Dbuildhelper.removeAll=true
else
echo -e "\nskip delete "
fi
echo -n "delete project's dependencies from local repo [y/N] "
read -n 1 del
#echo "$del"
if [ "$del" == "y" ] ; then
echo -e "\nperform delete "
mvn $@ -fn -T2 -o \
org.apache.maven.plugins:maven-dependency-plugin:3.1.1:purge-local-repository \
-DreResolve=false \
-DsnapshotsOnly=false \
-Dverbose=true
else
echo -e "\nskip delete"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment