7 echo "Info: Update Java alternatives"
8 echo "----------------------------------------------------"
9 sudo /usr/bin/update-alternatives --install /usr/bin/java java "${JAVA_HOME}/bin/java" 1
10 sudo /usr/bin/update-alternatives --install /usr/bin/javac javac "${JAVA_HOME}/bin/javac" 1
11 sudo /usr/bin/update-alternatives --install /usr/bin/javadoc javadoc "${JAVA_HOME}/bin/javadoc" 1
12 sudo /usr/bin/update-alternatives --install /usr/bin/jconsole jconsole "${JAVA_HOME}/bin/jconsole" 1
13 sudo /usr/bin/update-alternatives --install /usr/lib/jvm/java-openjdk java_sdk_openjdk "${JAVA_HOME}" 1
14 sudo /usr/bin/update-alternatives --set java "${JAVA_HOME}/bin/java"
15 sudo /usr/bin/update-alternatives --set javac "${JAVA_HOME}/bin/javac"
16 sudo /usr/bin/update-alternatives --set javadoc "${JAVA_HOME}/bin/javadoc"
17 sudo /usr/bin/update-alternatives --set jconsole "${JAVA_HOME}/bin/jconsole"
18 sudo /usr/bin/update-alternatives --set java_sdk_openjdk "${JAVA_HOME}"
19 echo "Info: Java version"
20 echo "----------------------------------------------------"
21 echo -e "\tJava version: $(java -version 2>&1 | head -n 1)"
22 echo -e "\tJava compiler version: $(javac -version)"
23 echo -e "\tJAVA_HOME set to: ${JAVA_HOME}"
24 echo "----------------------------------------------------"
25 echo "Downloading Maven $MVN_VERSION from $MVN_URL"
26 wget -q $MVN_URL && unzip -qq apache-maven-${MVN_VERSION}-bin.zip
27 echo "Info: Maven version"
28 echo "----------------------------------------------------"
30 echo "----------------------------------------------------"
31 echo "Downloading ONAP Maven XML for build process from oparent repo"
32 echo "----------------------------------------------------"
33 git clone "https://git.onap.org/oparent" $WORKSPACE/oparent
35 # Check if a commitid parameter is given to specify a version of
36 # oparent repository to checkout. If commitid is not provided, the
37 # latest master version is used as default for backward
38 # compatibility for existing ONAP jobs.
40 if [[ -v ${MVN_SETTINGS_XML_VERSION} ]]; then
41 git checkout "${MVN_SETTINGS_XML_VERSION}"
45 # if MVN_PARAMS set then use them otherwise default to ""
48 if [[ -n ${MVN_PARAMS} ]]; then
49 LOCAL_MVN_PARAMS=${MVN_PARAMS}
53 # Copy Onap maven settings.xml to Jenkins home directory
54 if [ ! -d /home/jenkins/.m2 ]; then
55 mkdir -p /home/jenkins/.m2/
57 cp settings.xml /home/jenkins/.m2/settings.xml
60 POMFILE="-f $WORKSPACE/pom.xml"
62 if [[ -n ${SUBDIRECTORY} ]]; then
63 POMFILE="-f $WORKSPACE/$SUBDIRECTORY/pom.xml"
64 echo "Setting pom.xml to use to $POMFILE"
68 # Set PATH to go executable
69 export PATH=${PATH}:${GO_PATH}
71 echo "----------------------------------------------------"
72 echo "Proceeding with unit test"
73 echo "----------------------------------------------------"
74 $MVN clean install -U -B $POMFILE -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn $LOCAL_MVN_PARAMS