After upgrade to 4.7 (from 4.4) task is no longer found

Sorry, my bad. You can’t use a String there since it’ll be interpreted as a file.

The cleanest solution is using a project dependency. I.e. attach the javaDoc jar as an artifact to a configuration in one project and then use a project dependency pointing to that configuration in the downstream project.

producer:

configurations {
  docs
}
artifacts {
  docs javadocJar
}

consumer:

configurations {
  aggregatedDocs
}
dependencies {
  aggregatedDocs project(path: ':producer', configuration: 'docs')
}
docTask {
  from configurations.aggregatedDocs
}