blob: 5cb0b004271ea5a60117ffd6f31c2b15c0f6a926 [file] [log] [blame]
robert.tomczyk08e50eb2020-08-11 16:53:28 +01001#!/bin/bash
2set -o errexit
3set -o nounset
4set -o pipefail
5
6cd $WORKSPACE
7echo "Info: Java version"
8echo "----------------------------------------------------"
9$JAVA_HOME/bin/java -version
10echo "----------------------------------------------------"
11echo "Downloading Maven $MVN_VERSION from $MVN_URL"
12wget -q $MVN_URL && unzip -qq apache-maven-${MVN_VERSION}-bin.zip
13echo "Info: Maven version"
14echo "----------------------------------------------------"
15$MVN -version
16echo "----------------------------------------------------"
robert.tomczyk750a20f2020-08-18 11:08:43 +010017echo "Downloading ONAP Maven XML for build process from oparent repo"
18echo "----------------------------------------------------"
19git clone "https://git.onap.org/oparent" $WORKSPACE/oparent
20cd $WORKSPACE/oparent
21# Check if a commitid parameter is given to specify a version of
22# oparent repository to checkout. If commitid is not provided, the
23# latest master version is used as default for backward
24# compatibility for existing ONAP jobs.
25set +o nounset
26if [[ -v ${MVN_SETTINGS_XML_VERSION} ]]; then
27 git checkout "${MVN_SETTINGS_XML_VERSION}"
28fi
29set -o nounset
afenner29099642020-08-28 16:09:31 +010030
31# if MVN_PARAMS set then use them otherwise default to ""
32LOCAL_MVN_PARAMS=""
33set +o nounset
34if [[ -n ${MVN_PARAMS} ]]; then
35 LOCAL_MVN_PARAMS=${MVN_PARAMS}
36fi
37set -o nounset
38
robert.tomczyk750a20f2020-08-18 11:08:43 +010039# Copy Onap maven settings.xml to Jenkins home directory
40if [ ! -d /home/jenkins/.m2 ]; then
41 mkdir -p /home/jenkins/.m2/
42fi
43cp settings.xml /home/jenkins/.m2/settings.xml
44cd $WORKSPACE
afennera6c9eaa2020-10-21 17:04:50 +010045
46POMFILE="-f $WORKSPACE/pom.xml"
47set +o nounset
48if [[ -n ${SUBDIRECTORY} ]]; then
49 POMFILE="-f $WORKSPACE/$SUBDIRECTORY/pom.xml"
50 echo "Setting pom.xml to use to $POMFILE"
51fi
52set -o nounset
53
robert.tomczyk750a20f2020-08-18 11:08:43 +010054echo "----------------------------------------------------"
robert.tomczyk08e50eb2020-08-11 16:53:28 +010055echo "Proceeding with unit test"
56echo "----------------------------------------------------"
afennera6c9eaa2020-10-21 17:04:50 +010057$MVN clean install -U -B $POMFILE -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn $LOCAL_MVN_PARAMS