1
votes

I'm using Jenkins to build a project. My build process is done through gradlew.

I set the gradlew location to: /var/jenkins_home/workspace/project/X/Y/Z/projectname/gradlew build javadoc

My build fails with this error: Task 'javadoc' not found in root project 'project'.

This means that Jenkins is trying to execute my task from the directory /var/jenkins_home/workspace/project/ instead of /var/jenkins_home/workspace/project/X/Y/Z/projectname/.

I don't understand how Jenkins is executing a task from the wrong directory. Any input on this issue is appreciated!

1

1 Answers

6
votes

Where you run a program from is different from the active directory when you run the command. You need to set into the directory before you run the command. If you are using a freestyle job, I believe you would want to set the root directory to tell gradle where your build file is.