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,280 points
242 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,870 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
50 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 in Jenkins by Sirajul
• 37,930 points
225 views
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,920 points
227 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,328 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 in Jenkins by Petr Doležal
1,701 views