# dokka

Wesley Hartford

10/20/2023, 10:13 PM
Hi, I'm trying to build HTML docs using dokka for a project which also uses Dagger (and therefore kapt) in gradle. When running
./gradlew build dokkaHtml
I get an error from gradle which I interpret as meaning that dokka is generating documentation from generated code without the appropriate task dependency being declared:
Copy code
> Task :metrics:kaptKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':metrics:kaptKotlin' (type 'KaptWithoutKotlincTask').
  - Gradle detected a problem with the following location: '[redacted]/metrics/build/tmp/kapt3/classes/main'.
    Reason: Task ':metrics:dokkaHtml' uses this output of task ':metrics:kaptKotlin' 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 ':metrics:kaptKotlin' as an input of ':metrics:dokkaHtml'.
      2. Declare an explicit dependency on ':metrics:kaptKotlin' from ':metrics:dokkaHtml' using Task#dependsOn.
      3. Declare an explicit dependency on ':metrics:kaptKotlin' from ':metrics:dokkaHtml' using Task#mustRunAfter.
    For more information, please refer to <> in the Gradle documentation.
I can work around this by declaring a dependency as described in the error message, but I think my preference would be for dokka to ignore generated code. Has anyone run into a similar problem? Any advice? Thanks.

Ignat Beresnev

10/26/2023, 9:20 AM
Hi! Unfortunately, this is a known issue for which we don't have a solution yet: There's a configuration option called
, which is set to
by default. It ignores generated files from
, but it's implementation is that it adds these files to the
option, so it effectively still knows about them and it might be causing the undeclared dependency - this is just a guess though. We're unlikely to fix it for the current Dokka Gradle plugin as we're focusing on the new plugin which will address this and other problems, so the best bet is to find a suitable local workaround for now. Sorry for the inconvenience.

Wesley Hartford

10/26/2023, 2:54 PM
Thanks, I added the task dependency and the error went away. If I submitted a PR that enabled a better work-around, do you think it would be accepted?