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


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,


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’


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