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

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 \

In the Jenkinsfile, replace the agent part


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

Related Questions In Jenkins

0 votes
2 answers
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,560 points
+2 votes
5 answers
0 votes
1 answer

Jenkins: Build Pipeline Plugin Scheduled Trigger

This can be done by setting the ...READ MORE

answered Jul 10, 2018 in Jenkins by Sophie may
• 9,330 points
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,140 points
+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
0 votes
1 answer

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

Follow the below steps: 1.      Install the Groovy ...READ MORE

answered Aug 9, 2018 in Jenkins by Sophie may
• 9,330 points

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.