anyone know how to fix: `Reason: Task ':generateMe...
# gradle
p
anyone know how to fix:
Reason: Task ':generateMetadataFileForPluginMavenPublication' uses this output of task ':publishPluginJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
?
Copy code
tasks.named(":generateMetadataFileForPluginMavenPublication") {
    dependsOn(":publishPluginJar")
    dependsOn(":publishPluginJavaDocsJar")
}
does not work … task not found
Task with name ':generateMetadataFileForPluginMavenPublication' not found in root project
v
The
:
is not part of the name, it is a separator
like
/
for file paths
But actually adding manual
dependsOn
statements is in 80% of the cases a sign that your build does something wrong
p
i did try with and without
:
.. same problem 😞
v
Then the task is not yet registered at the time you try to get it.
Copy code
tasks.withType<GenerateModuleMetadata>().matching {
    it.name == "generateMetadataFileForPluginMavenPublication"
}.configureEach {
    dependsOn(":publishPluginJar")
    dependsOn(":publishPluginJavaDocsJar")
}
p
interesting… either way, not sure why this is a problem related to (internal) tasks defined by one of gradle’s own plugins, seems odd
v
Hard to say without seeing your build. It is most probably due to something you do in your build scripts. If you definitely think it is not, you should open an issue about it on GitHub. But also there you probably need to provide an MCVE.
1