simple-java-maven-app | introductory tutorial on how to use Jenkins | Build Tool library
kandi X-RAY | simple-java-maven-app Summary
kandi X-RAY | simple-java-maven-app Summary
For an introductory tutorial on how to use Jenkins to build a simple Java application with Maven.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Prints the message
- Returns the error message
simple-java-maven-app Key Features
simple-java-maven-app Examples and Code Snippets
Community Discussions
Trending Discussions on simple-java-maven-app
QUESTION
I have a parameterized Pipeline Jenkins project connected to a Maven project that I forked from https://github.com/jenkins-docs/simple-java-maven-app. I am trying to pass a parameter called "Platform" I have set in the Jenkins Project: shown here
Before implementing this on my own, larger project, I wanted to see if it was possible to pass a parameter from Jenkins to the Java application via Maven. I've tried some solutions seen in below code.
However, no matter what I try, I still get null when running System.getProperty("platform")
. I'm not sure what I could be doing incorrectly. Am I missing something or is there some incorrect syntax I'm just not identifying?
Code snippets below:
Jenkinsfile
...ANSWER
Answered 2018-Sep-24 at 05:21You try to set a parameter in the wrong place (in the build step). In maven, each run is independently and not store any information about the parameters. The parameter must be sent when is needed may be on this line mvn jar:jar install:install help:evaluate -Dexpression=project.name -Dplatform="$1" -> this should be sent as parameter from the Jenkins job sh './jenkins/scripts/deliver.sh ${params.Platform}'}
QUESTION
I am following this tutorial to build a hello-world maven java app with jenkins in dockers: https://jenkins.io/doc/tutorials/building-a-java-app-with-maven/#fork-and-clone-the-sample-repository-on-github
This is my app (just fork form the tutorial): simple-java-maven-app
It has a small difference that I used remote repo (Github) not a local repo (or host repo) in Pipeline's option (Repository URL). I pushed Jenkinsfile to repo then build hello-world app with Pipeline.
...ANSWER
Answered 2017-Nov-24 at 16:26You are using Docker in Docker (DinD) which is not a recommended CI approach. You should mount your Host's Docker Daemon Socket as volume to the Jenkins container like:
docker container run -v /var/run/docker.sock:/var/run/docker.sock ...
So you can work with images & containers on your host machine rather than in the Jenkins container. Click Here to learn more.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install simple-java-maven-app
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page