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,270 points
205 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
• 9,530 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 in Jenkins by Hari
29 views
0 votes
1 answer

Why is it displaying Jenkins build failure for Android app

I think you should try this. Try Uninstalling ...READ MORE

answered Apr 12, 2018 in Jenkins by shubham
• 6,890 points
237 views
+2 votes
5 answers
0 votes
1 answer
0 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
• 56,520 points
156 views
+1 vote
6 answers

Error: Jenkins Maven Build 137

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

answered May 5 in Jenkins by Danica
1,113 views
0 votes
2 answers

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

Since the groovy script is a bit complex ...READ MORE

answered Jul 31 in Jenkins by Sirajul
• 25,700 points
949 views