ONAP: Handle MVN settings.xml file as part of project build
[infra/cicd.git] / jjb / onap / verify-jobs.sh
index fe437ef7da0ecfcc14af9e8ec13968c6f63c96dd..b07f82dced9813087b7f061ee9869e6bbca8c7f4 100755 (executable)
@@ -14,6 +14,26 @@ echo "Info: Maven version"
 echo "----------------------------------------------------"
 $MVN -version
 echo "----------------------------------------------------"
+echo "Downloading ONAP Maven XML for build process from oparent repo"
+echo "----------------------------------------------------"
+git clone "https://git.onap.org/oparent" $WORKSPACE/oparent
+cd $WORKSPACE/oparent
+# Check if a commitid parameter is given to specify a version of
+# oparent repository to checkout. If commitid is not provided, the
+# latest master version is used as default for backward
+# compatibility for existing ONAP jobs.
+set +o nounset
+if [[ -v ${MVN_SETTINGS_XML_VERSION} ]]; then
+  git checkout "${MVN_SETTINGS_XML_VERSION}"
+fi
+set -o nounset
+# Copy Onap maven settings.xml to Jenkins home directory
+if [ ! -d /home/jenkins/.m2 ]; then
+  mkdir -p /home/jenkins/.m2/
+fi
+cp settings.xml /home/jenkins/.m2/settings.xml
+cd $WORKSPACE
+echo "----------------------------------------------------"
 echo "Proceeding with unit test"
 echo "----------------------------------------------------"
 $MVN clean install -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
\ No newline at end of file