Task doesn't get executed while depending on it inside another task


(Guy Brand) #1

Hi,

why doesn’t the javadoc task gets executed when I just execute the following jar task while depending on the destinationDir of the javadoc task?

task jarJavadoc(type: Jar) {

from javadoc.destinationDir

classifier = ‘javadoc’ }

Thanks and regards,

guy


(Peter Niederwieser) #2

Gradle can only figure out a task dependency automatically if you pass a ‘Buildable’ to the consuming task. ‘javadoc.destinationDir’ returns a ‘java.io.File’ which doesn’t implement ‘Buildable’. Here is how to fix this:

task jarJavadoc(type: Jar) {

from javadoc // same as: from javadoc.outputs.files

classifier = ‘javadoc’

}


(Guy Brand) #3

Thanks a lot for the quick and useful answer. It worked! :slight_smile: