Fix the docker build error for vfc-nfvo-wfengine
[vfc/nfvo/wfengine.git] / wfenginemgrservice / src / main / docker / wfenginemgrservice-docker-build_image.sh
index fade340..3cb0918 100644 (file)
@@ -14,10 +14,35 @@ IMAGE="wfengine-mgrservice"
 DOCKER_REPOSITORY="nexus3.onap.org:10003"
 IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}"
 
+if [ -z $NEXUS_REPOS_URL ]; then
+  NEXUS_REPOS_URL="https://nexus.onap.org"
+fi
+
 POM_DIR="../../../"
 cd ${POM_DIR}
-# VERSION=$(printf 'VER\t${project.version}'|mvn help:evaluate|grep '^VER'|cut -f2|echo)
-# VERSION=$(printf 'VER\t${project.version}'|mvn help:evaluate)
+env
+mvncmd=$(whereis mvn | grep ^mvn |awk '{print $2}')
+if [[ 1$mvncmd != 1 ]]; then
+  echo $mvncmd
+elif [ $MVN ]; then
+  echo MVN
+  mvncmd=$MVN
+elif [ $M2_HOME ]; then
+  echo M2_HOME
+  mvncmd=$M2_HOME/bin/mvn
+elif [ -f "/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn" ]; then
+  echo /w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn
+  mvncmd="/w/tools/hudson.tasks.Maven_MavenInstallation/mvn33/bin/mvn"
+elif [ -f "/usr/share/maven/bin/mvn" ]; then
+  mvncmd="/usr/share/maven/bin/mvn"
+else
+  echo "Maven is not installed, mvncmd=$mvncmd"
+  exit 1
+fi
+echo "mvncmd=${mvncmd}"
+
+pwd
+VERSION=$(printf 'VER\t${project.version}'|$mvncmd help:evaluate|grep '^VER'|cut -f2)
 echo "VERSION=${VERSION}"
 
 cd ${DOCKER_BUILD_DIR}
@@ -47,9 +72,9 @@ fi
 echo "CURLPROXY=${CURLPROXY}"
 
 rm -f ./bin/workflow-engine-mgr-service*.jar
-echo "${CURLPROXY}" -m 300 -O -J -L  "https://nexus.onap.org/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}" LATEST
-#curl "${CURLPROXY}" -m 300 -O -J -L  "https://nexus.onap.org/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
-wget --output-file=workflow-engine-mgr-service.jar "https://nexus.onap.org/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
+echo "${CURLPROXY}" -m 300 -O -J -L  "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}" LATEST
+#curl "${CURLPROXY}" -m 300 -O -J -L  "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
+wget -O workflow-engine-mgr-service.jar "${NEXUS_REPOS_URL}/service/local/artifact/maven/content?r=${NEXUSREPONAME}&g=org.onap.vfc.nfvo.wfengine&a=workflow-engine-mgr-service&e=jar&v=${VERSION}"
 mv workflow-engine-mgr-service*.jar ./bin/workflow-engine-mgr-service.jar 
 
 function build_image {