How to programmatically execute war task for subprojects?

I’ve a multiple module project managed witg gradle. The directory structure is as follows:

monitoring - client - server

Because of the fact that jetty plugin does not support running multiple wars I need to write custom task on monitoring level that will start both client and server with jetty-runner.

In monitoring’s build.gradle I have

task jettyRunner << {

}

jettyRunner.dependsOn(war)

I want this dependency (war) to be executed for subprojectes (client and server) not for monitoring. How to handle that?

jettyRunner.dependsOn(":client:war", ":server:war")

Also see the multi-project builds chapter in the Gradle user guide.

Thank You very much for this valuable response.