ONAP: Set correct Java alternatives for ONAP project
Change-Id: I0c270b07883304843c7c0d04df4b9e0b3b621dde
diff --git a/jjb/onap/verify-jobs.sh b/jjb/onap/verify-jobs.sh
index 5cb0b00..7a850b0 100755
--- a/jjb/onap/verify-jobs.sh
+++ b/jjb/onap/verify-jobs.sh
@@ -4,9 +4,23 @@
set -o pipefail
cd $WORKSPACE
+echo "Info: Update Java alternatives"
+echo "----------------------------------------------------"
+sudo /usr/bin/update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 1
+sudo /usr/bin/update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 1
+sudo /usr/bin/update-alternatives --install /usr/bin/javadoc javadoc "${JAVA_HOME}/bin/javadoc" 1
+sudo /usr/bin/update-alternatives --install /usr/bin/jconsole jconsole "${JAVA_HOME}/bin/jconsole" 1
+sudo /usr/bin/update-alternatives --install /usr/lib/jvm/java-openjdk java_sdk_openjdk "${JAVA_HOME}" 1
+sudo /usr/bin/update-alternatives --set java "${JAVA_HOME}/bin/java"
+sudo /usr/bin/update-alternatives --set javac "${JAVA_HOME}/bin/javac"
+sudo /usr/bin/update-alternatives --set javadoc "${JAVA_HOME}/bin/javadoc"
+sudo /usr/bin/update-alternatives --set jconsole "${JAVA_HOME}/bin/jconsole"
+sudo /usr/bin/update-alternatives --set java_sdk_openjdk "${JAVA_HOME}"
echo "Info: Java version"
echo "----------------------------------------------------"
-$JAVA_HOME/bin/java -version
+echo -e "\tJava version: $(java -version 2>&1 | head -n 1)"
+echo -e "\tJava compiler version: $(javac -version)"
+echo -e "\tJAVA_HOME set to: ${JAVA_HOME}"
echo "----------------------------------------------------"
echo "Downloading Maven $MVN_VERSION from $MVN_URL"
wget -q $MVN_URL && unzip -qq apache-maven-${MVN_VERSION}-bin.zip