执行Gradle多项目的子模块的任务

时间:2017-02-03 15:02:37

标签: gradle multi-project gradle-task

我有以下多项目结构:

settings.gradle

rootProject.name = 'toolbox-backend'
include 'toolbox-components-rest'
include 'toolbox-components-executor'
include 'toolbox-components-toolsyncer'

我想在我的root build.gradle 中创建一个任务,它将调用 clean build 安装(应用程序),最后是 toolbox-components-rest 子模块的运行任务。

1 个答案:

答案 0 :(得分:0)

task startREST() {

dependsOn ':toolbox-components-rest:clean'
dependsOn ':toolbox-components-rest:build'
dependsOn ':toolbox-components-rest:bootRun'

println "[Toolbox $version] Starting REST interface..."
}

这确实有效 - 但是在清理之前运行的build之前,bootRun任务正在运行。我想完全相反

修正了上述问题
bootRun.mustRunAfter build
build.mustRunAfter clean

toolbox-components-rest 子模块的gradle.build中

相关问题