Gradle Custom Plugin task .dependsOn with Command line parameters

318 Views Asked by At

I'm developing a custom Gradle Plugin that depends on another plugin. For a specific task to run I have to run a task from an external plugin first.

project.tasks.create("MyTaskName", MyTaskName) {
    it.description = "MyDescription"
}.dependsOn("taskFromOtherPlugin")

So far I'm simply using the base functionality. However, I need to infer command line parameters to the other tasks plugin. When running the external task manually it would just be:

gradle taskFromOtherPlugin --parameter1 value1

How do I get the --parameter1 value1 into the .dependsOn structure? So what I would need is something like

project.tasks.create("MyTaskName", MyTaskName) {
    it.description = "MyDescription"
}.dependsOn("taskFromOtherPlugin --parameter1 value1")
0

There are 0 best solutions below