kevin cline
kevin cline

Reputation: 2736

Gradle: How to create javaCompile dependency?

I want a task in my top-level build.gradle file to depend on running 'compileJava' in subprojects. Currently the top-level.gradle file says:

subprojects {
    apply plugin: "java"
}

task wrap(dependsOn: 'compileJava' ...)

This does not work. I can say gradle compileJava and it runs the "compileJava" target on all subprojects. But there is no "compileJava" task in the top-level project.

How can I make the "wrap" task depend on "compileJava" ?

Upvotes: 0

Views: 1093

Answers (1)

Peter Niederwieser
Peter Niederwieser

Reputation: 123910

task wrap {
    dependsOn { subprojects.compileJava }
}

Upvotes: 1

Related Questions