Jenkins - maven project fails at Build stage

0 votes

I'm running a Jenkins Maven Project using Docker, and I keep getting this error at the build stage:

 [simple-java-maven-app] Running shell script
sh: can't create /var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-bae402a9/jenkins-log.txt: nonexistent directory
sh: can't create /var/jenkins_home/workspace/simple-java-maven-app@tmp/durable-bae402a9/jenkins-result.txt: nonexistent directory
Aug 10, 2018 in Jenkins by Tyrion anex
• 8,700 points
1,927 views

1 answer to this question.

0 votes

To fix this, you need to change 2 things.

  • docker run args
  • Jenkinsfile docker agent args

For my own usage, I used this

docker run -d \
  --env "JENKINS_HOME=$HOME/Library/Jenkins" \
  --restart always \
  --name jenkins \
  -u root \
  -p 8080:8080 \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v $HOME/Library/Jenkins:$HOME/Library/Jenkins \
  -v "$HOME":/home \
  jenkinsci/blueocean

In the Jenkinsfile, replace the agent part

by

agent {
  docker {
    image 'maven:3-alpine'
    args '-v <host_home_path>/.m2:/root/.m2'
  }
answered Aug 10, 2018 by Sophie may
• 10,610 points

Related Questions In Jenkins

0 votes
2 answers
0 votes
1 answer

Getting below error on Jenkins while creating a Maven Build Job

When you are using ssh to connect, ...READ MORE

answered Sep 3, 2019 in Jenkins by Hari
2,052 views
0 votes
1 answer

How to fix a broken build for my project in jenkins?

The user needs to open the console ...READ MORE

answered Oct 11, 2019 in Jenkins by Sirajul
• 59,230 points
8,023 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,471 views
+1 vote
7 answers

Error: Jenkins Maven Build 137

I disagree with @Pam's answer. The problem ...READ MORE

answered May 6, 2019 in Jenkins by Danica
8,275 views
0 votes
3 answers

How to get the Maven Version of a project in Jenkins?

Here is a snippet from our Jenkins ...READ MORE

answered Oct 4, 2019 in Jenkins by Petr Doležal
22,106 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP