Gradle build only one module

I have a multiple module gradle build. I want to execute targets for one module using root. Ex :

gradle build -Pmodule=ABC
gradle jar -Pmodule=ABC
gradle test -Pmodule=ABC
gradle compileJava -Pmodule=ABC
gradle customTask -Pmodule=ABC
etc.

So every target can be run from root specifying the module. Is there a simple way to do this?

Thanks !


To execute a task of a specific subproject, specify its task path. For example:

gradle :ABC:build

The leading : stands for the root project. ABC is the subproject, and build a task in that project.


Found a quick way

gradle build -p moduleA

moduleA is the module's directory.

Above command builds a moduleA and all its submodules, and moduleA should be its path


On Mac OS, the only variant which is working with me :

./gradlew  ABC:build

ABC is the name of module

( It might be working on Linux too )