I have 2 gradle projects. Lets say projectA and projectB. I need to create a task in projectA, which can execute a task in projectB. I tried with many ways, but i couldn't find a way to do that. Consider following code,

//ProjectA build.gradle
task taskA(dependsOn: ProjectB.taskB) << { println "executed taskB" }


//ProjectB build.gradle
task taskB() << { println "executing taskB"}

when I run taskA output should be,

>> gradle taskA
executing taskB
executed taskB

Can I anyhow achieve this?

thanks.

有帮助吗?

解决方案

task taskA(dependsOn: project(":ProjectB").taskB)

We don't say that taskA executes taskB but that it depends on taskB.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top