xetra11
xetra11

Reputation: 8837

Execute a Task of a sub-module of a Gradle multiproject

I have the following multiproject structure:

settings.gradle

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

I'd love to create a task in my root build.gradle which will call the clean, build, install (application) and finally the run task of the toolbox-components-rest submodule.

Upvotes: 0

Views: 1731

Answers (1)

xetra11
xetra11

Reputation: 8837

task startREST() {

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

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

This does work - BUT the bootRun task is running before build which runs before clean. I'd like to have it exactly the other way around

Fixed the above with

bootRun.mustRunAfter build
build.mustRunAfter clean

in the gradle.build of the toolbox-components-rest submodule

Upvotes: 1

Related Questions