Could not able to configure Jenkins job for Gradle subfolder in git repository. This works in Maven

I have a Git repository with multiple projects say A, B and C. Each of these projects are built separately with their own settings.gradle files. These projects have sub modules. The root of the repository does not contain any gradle files.

For maven I configured the Root Pom in Jenkins as A/pom.xml. And this works.

For gradle I am providing tasks as




This is failing with below error:

FAILURE: Build failed with an exception.

  • What went wrong:
    Project ‘A’ not found in root project ‘Job Name’.

You’ll have to pass a value the -p to set the project directory otherwise gradle will assume the current directory (root of the repo).

gradle -p A build