I inherited a bunch of code that’s built by gradle. There a bunch of build.gradle files scattered through the directory structure. I want to find out which file contributes the definition of a specific task. For example dockerComposeUp.
When I execute cat build.gradle|grep docker in the root directory of root project, I get nothing useful about the origins of dockerComposeUp:
That’s what I thought too. But how would I find out which plugin registers the task? And in which file that plug in is applied given the multi-project build context? Many thanks.
If it would be an idiomatic build, you would find it in the build script of the project where the task exists, or from there a convention plugin that applies the plugin and so on.
But not knowing your build, it could also follow bad practices and use for example cross-project configuration like having an allprojects { ... } or subprojects { ... } somewhere. Many possibilities if the build is not written in a maintainable way, so hard to guess.
To find the plugin which registers the task, you could for example use ./gradlew help --task theTask to see the class it has and then maybe derive the according plugin from that.