diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index 966859677a..5085b47e74 100644 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -6,12 +6,12 @@ pipeline { stages { stage('Build') { steps { - sh 'mvn -B -DskipTests clean package' + bat '"%MAVEN_HOME%\\bin\\mvn" -B -DskipTests clean package' } } stage('Test') { steps { - sh 'mvn test' + bat '"%MAVEN_HOME%\\bin\\mvn" test' } post { always { @@ -21,7 +21,7 @@ pipeline { } stage('Deliver') { steps { - sh './jenkins/scripts/deliver.sh' + bat 'jenkins\\scripts\\deliver.bat' } } } diff --git a/jenkins/scripts/deliver.bat b/jenkins/scripts/deliver.bat new file mode 100644 index 0000000000..adf6e7d462 --- /dev/null +++ b/jenkins/scripts/deliver.bat @@ -0,0 +1,22 @@ +@echo off +echo The following Maven command installs your Maven-built Java application +echo into the local Maven repository, which will ultimately be stored in +echo Jenkins's local Maven repository (and the "maven-repository" Docker data volume). + +REM Run Maven install +mvn jar:jar install:install help:evaluate -Dexpression=project.name + +echo The following command extracts the value of the element +echo within of your Java/Maven project's "pom.xml" file. + +FOR /F "delims=" %%i IN ('mvn -q -DforceStdout help:evaluate -Dexpression=project.name') DO SET NAME=%%i + +echo The following command behaves similarly to the previous one but +echo extracts the value of the element within instead. + +FOR /F "delims=" %%i IN ('mvn -q -DforceStdout help:evaluate -Dexpression=project.version') DO SET VERSION=%%i + +echo The following command runs and outputs the execution of your Java +echo application (which Jenkins built using Maven) to the Jenkins UI. + +java -jar target\%NAME%-%VERSION%.jar diff --git a/jenkins/scripts/deliver.sh b/jenkins/scripts/deliver.sh deleted file mode 100755 index 39a0636699..0000000000 --- a/jenkins/scripts/deliver.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -echo 'The following Maven command installs your Maven-built Java application' -echo 'into the local Maven repository, which will ultimately be stored in' -echo 'Jenkins''s local Maven repository (and the "maven-repository" Docker data' -echo 'volume).' -set -x -mvn jar:jar install:install help:evaluate -Dexpression=project.name -set +x - -echo 'The following command extracts the value of the element' -echo 'within of your Java/Maven project''s "pom.xml" file.' -set -x -NAME=`mvn -q -DforceStdout help:evaluate -Dexpression=project.name` -set +x - -echo 'The following command behaves similarly to the previous one but' -echo 'extracts the value of the element within instead.' -set -x -VERSION=`mvn -q -DforceStdout help:evaluate -Dexpression=project.version` -set +x - -echo 'The following command runs and outputs the execution of your Java' -echo 'application (which Jenkins built using Maven) to the Jenkins UI.' -set -x -java -jar target/${NAME}-${VERSION}.jar