Gradle task not found in root project

14,827

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.

Share:
14,827
Pedro Pinto
Author by

Pedro Pinto

Updated on June 13, 2022

Comments

  • Pedro Pinto
    Pedro Pinto almost 2 years

    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!

  • Pedro Pinto
    Pedro Pinto over 6 years
    Right! I forgot to change the advanced gradlew configuration "Root Build script". Thank you :)