Error Task ':projec-2:dokkaGeneratePublicationHtml' uses this output of task ':projec-1:dokkaGeneratePublicationHtml' without declaring an explicit or implicit dependency.
Describe the bug Muti-module project with
dependencies {
dokka(project(":projec-1"))
dokka(project(":projec-2"))
}
I get an error like this:
Reason: Task ':projec-2:dokkaGeneratePublicationHtml' uses this output of task ':projec-1:dokkaGeneratePublicationHtml' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':projec-1:dokkaGeneratePublicationHtml' as an input of ':projec-2:dokkaGeneratePublicationHtml'.
2. Declare an explicit dependency on ':projec-1:dokkaGeneratePublicationHtml' from ':projec-2:dokkaGeneratePublicationHtml' using Task#dependsOn.
3. Declare an explicit dependency on ':projec-1:dokkaGeneratePublicationHtml' from ':projec-2:dokkaGeneratePublicationHtml' using Task#mustRunAfter.
when running gradle dokkaGeneratePublicationHtml.
Expected behaviour
gradle dokkaGeneratePublicationHtml is running successfully
Screenshots If applicable, add screenshots to help explain your problem
To Reproduce
May be because project-1 build.gradle.kts contains
dependencies {
api(project(":project-1"))
}
Dokka configuration Configuration of dokka used to reproduce the bug
Installation
- Operating system: Linux Ubuntu
- Build tool: Gradle v8.12.1
- Dokka version: 2.0.0
Additional context Add any other context about the problem here
I made dependencies between tasks like this:
tasks.named("dokkaGeneratePublicationHtml") {
dependsOn(project(":project-1").tasks.named("dokkaGeneratePublicationHtml"))
}
but ran into circular dependencies issue
I added a lot of
tasks.named("dokkaGenerateModuleHtml") {
dependsOn(project(":another-subproject").tasks.named("dokkaGeneratePublicationHtml"))
...
}
tasks.named("dokkaGeneratePublicationHtml") {
dependsOn(project(":another-subproject").tasks.named("dokkaGeneratePublicationHtml"))
...
}
into build.gradle.kts and after that I got compilation errors (unresolved)
But project can be compiled with gradle build -x test
The multiproject has 110 subprojects and it's hard to add task dependencies to every build.gradle.kts.
Hi, thanks for the report.
The error message Task ':projec-2:dokkaGeneratePublicationHtml' uses this output of task ':projec-1:dokkaGeneratePublicationHtml' without declaring an explicit or implicit dependency. indicates the buildscripts are doing some something unconventional. The dokkaGeneratePublicationHtml tasks are supposed to be the final aggregated output, and not directly depended on across projects. But I can't say more than that without looking at the Gradle configuration.
Are you able to share the project? Or can you create a reproducer?