-
-
Save clathrop/28aeffd8f030e8169552 to your computer and use it in GitHub Desktop.
Build-deploy script which looks at the java version defined in a projects pom.xml and sets the environment java version accordingly then runs a maven build and deploy. Supports java 1.7 & 1.8 but can easily be extended to support previous and future java releases.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Build-deploy script which looks at the java version defined in a projects pom.xml | |
# and sets the environment java version accordingly then runs a maven build and deploy. | |
# Supports java 1.7 & 1.8 but can easily be extended to support previous and future java | |
# releases. | |
grep "<source>" pom.xml | grep "1.7" >/dev/null | |
if [ $(echo $?) -eq "0" ] | |
then | |
jv=1.7 | |
fi | |
grep "<source>" pom.xml | grep "1.8" >/dev/null | |
if [ $(echo $?) -eq "0" ] | |
then | |
jv=1.8 | |
fi | |
export JAVA_HOME=$(/usr/libexec/java_home -v $jv) | |
echo "java version is $jv" | |
echo "running: mvn clean install -P auto-deploy" | |
mvn clean install -P auto-deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment