robert.tomczyk | 08e50eb | 2020-08-11 16:53:28 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -o errexit |
| 3 | set -o nounset |
| 4 | set -o pipefail |
| 5 | |
| 6 | cd $WORKSPACE |
| 7 | echo "Info: Java version" |
| 8 | echo "----------------------------------------------------" |
| 9 | $JAVA_HOME/bin/java -version |
| 10 | echo "----------------------------------------------------" |
| 11 | echo "Downloading Maven $MVN_VERSION from $MVN_URL" |
| 12 | wget -q $MVN_URL && unzip -qq apache-maven-${MVN_VERSION}-bin.zip |
| 13 | echo "Info: Maven version" |
| 14 | echo "----------------------------------------------------" |
| 15 | $MVN -version |
| 16 | echo "----------------------------------------------------" |
robert.tomczyk | 750a20f | 2020-08-18 11:08:43 +0100 | [diff] [blame] | 17 | echo "Downloading ONAP Maven XML for build process from oparent repo" |
| 18 | echo "----------------------------------------------------" |
| 19 | git clone "https://git.onap.org/oparent" $WORKSPACE/oparent |
| 20 | cd $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. |
| 25 | set +o nounset |
| 26 | if [[ -v ${MVN_SETTINGS_XML_VERSION} ]]; then |
| 27 | git checkout "${MVN_SETTINGS_XML_VERSION}" |
| 28 | fi |
| 29 | set -o nounset |
afenner | 2909964 | 2020-08-28 16:09:31 +0100 | [diff] [blame] | 30 | |
| 31 | # if MVN_PARAMS set then use them otherwise default to "" |
| 32 | LOCAL_MVN_PARAMS="" |
| 33 | set +o nounset |
| 34 | if [[ -n ${MVN_PARAMS} ]]; then |
| 35 | LOCAL_MVN_PARAMS=${MVN_PARAMS} |
| 36 | fi |
| 37 | set -o nounset |
| 38 | |
robert.tomczyk | 750a20f | 2020-08-18 11:08:43 +0100 | [diff] [blame] | 39 | # Copy Onap maven settings.xml to Jenkins home directory |
| 40 | if [ ! -d /home/jenkins/.m2 ]; then |
| 41 | mkdir -p /home/jenkins/.m2/ |
| 42 | fi |
| 43 | cp settings.xml /home/jenkins/.m2/settings.xml |
| 44 | cd $WORKSPACE |
afenner | a6c9eaa | 2020-10-21 17:04:50 +0100 | [diff] [blame^] | 45 | |
| 46 | POMFILE="-f $WORKSPACE/pom.xml" |
| 47 | set +o nounset |
| 48 | if [[ -n ${SUBDIRECTORY} ]]; then |
| 49 | POMFILE="-f $WORKSPACE/$SUBDIRECTORY/pom.xml" |
| 50 | echo "Setting pom.xml to use to $POMFILE" |
| 51 | fi |
| 52 | set -o nounset |
| 53 | |
robert.tomczyk | 750a20f | 2020-08-18 11:08:43 +0100 | [diff] [blame] | 54 | echo "----------------------------------------------------" |
robert.tomczyk | 08e50eb | 2020-08-11 16:53:28 +0100 | [diff] [blame] | 55 | echo "Proceeding with unit test" |
| 56 | echo "----------------------------------------------------" |
afenner | a6c9eaa | 2020-10-21 17:04:50 +0100 | [diff] [blame^] | 57 | $MVN clean install -U -B $POMFILE -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn $LOCAL_MVN_PARAMS |