forked from jenkins-docs/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 'deliver.sh' within /jenkins/scripts directory.
* This file contains the 'Deliver' stage shell script that will be run during this stage of the Pipeline.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/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 complex command extracts the value of the <name/> element' | ||
echo 'within <project/> of your Java/Maven project''s "pom.xml" file.' | ||
set -x | ||
NAME=`mvn help:evaluate -Dexpression=project.name | grep "^[^\[]"` | ||
set +x | ||
|
||
echo 'The following complex command behaves similarly to the previous one but' | ||
echo 'extracts the value of the <version/> element within <project/> instead.' | ||
set -x | ||
VERSION=`mvn help:evaluate -Dexpression=project.version | grep "^[^\[]"` | ||
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 |