我的项目结构看起来像
Root + subproj1
+ subproj2
在每个子项目中定义了自己的任务 run(){}。我要做的是从 Root 项目的运行任务并行运行 :subproj1:run, :subproj2:run 。我尝试在根项目的 build.gradle
task run(){
def threads = 2
def tasks = [ ":subproj1:run", ":subproj2:run" ]
tasks.each {
new Thread(){
public void run(){
dependsOn it
}
}.start();
}
}
但它有一个例外
Exception in thread "Thread-12" org.gradle.api.UnknownProjectException:
Project with path ':subproj1:run' could not be found in root project 'ROOT'
我如何从根项目并行运行子项目的任务?