Skip to content

Instantly share code, notes, and snippets.

@digulla
Created October 8, 2012 13:18
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 digulla/3852490 to your computer and use it in GitHub Desktop.
Save digulla/3852490 to your computer and use it in GitHub Desktop.
Better mvn deploy
#!/bin/bash
if [[ ! -e pom.xml ]]; then
echo "Missing pom.xml" 1>&2
exit 1
fi
sed \
-e '/<distributionManagement>/,/<\/distributionManagement>/d' \
-e '/<\/project/d' \
pom.xml > pom-deploy.xml || exit 1
cat >> pom-deploy.xml <<EOF
<!-- ADDED BY $0 -->
<distributionManagement>
... whatever you need ...
</distributionManagement>
</project>
EOF
mvn -f pom-deploy.xml clean install && \
mvn -f pom-deploy.xml deploy -DskipTests=true && \
rm pom-deploy.xml
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment