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
161 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,430 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,870 points
199 views
+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,430 points
233 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,160 points
99 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
837 views
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,430 points
371 views