Dokka: Dokka 0.10.0: Extension of type 'GradlePassConfigurationImpl' does not exist (gradle plugin)

Created on 8 Oct 2019  路  6Comments  路  Source: Kotlin/dokka

Describe the bug
After upgrade from 0.9.18 to 0.10.0 an error occurs when trying to run the dokka gradle task:

An exception occurred applying plugin request [id: 'org.jetbrains.dokka']
> Failed to apply plugin [id 'org.jetbrains.dokka']
   > Could not create task ':soft-torque-audit:dokka'.
      > Extension of type 'GradlePassConfigurationImpl' does not exist. Currently registered extension types: [ExtraPropertiesExtension]

It seems that DokkaTask.configuration isn't set properly and then getting this field fails: https://github.com/Kotlin/dokka/blob/de2f32d91fb6f564826ddd7644940452356e2080/runners/gradle-plugin/src/main/kotlin/org/jetbrains/dokka/gradle/DokkaTask.kt#L67-L70

Expected behaviour
I expect the dokka task to be created without errors.

Screenshots

To Reproduce
Just add a configuration {} block to the dokka task and the error appears

Dokka configuration
Configuration of dokka used to reproduce the bug

tasks.withType<DokkaTask> {
  outputFormat = "html"
  configuration {
  }
}

Installation

  • Operating system: Windows
  • Build tool: Gradle v5.6.2
  • Dokka version: 0.10.0

Additional context

bug

Most helpful comment

There you go: https://github.com/mpe85/dokka-test

I guess it happens because I use gradle subprojects.
In the root project I specify the plugin version without actually applying the plugin (to root):

plugins {
    kotlin("jvm") version "1.3.50" apply false
    id("org.jetbrains.dokka") version "0.10.0" apply false
}

In some of my subprojects I apply the plugin, the version is then inherited from the definition in the root project:

plugins {
    java
    kotlin("jvm")
    id("org.jetbrains.dokka")
}

By the way: If I remove configuration { } from the dokka task the 'Failed to apply plugin' error does not show up, but instead I get a stack overflow when running the dokka task:

Cause: java.lang.StackOverflowError
    at org.gradle.api.artifacts.ResolveException.buildMessage(ResolveException.java:36)
    at org.gradle.api.artifacts.ResolveException.<init>(ResolveException.java:32)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException.<init>(DefaultLenientConfiguration.java:345)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1258)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2200(DefaultConfiguration.java:139)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1233)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:491)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:481)
    at org.jetbrains.dokka.gradle.DokkaTask.tryResolveFatJar(DokkaTask.kt:91)
    at org.jetbrains.dokka.gradle.DokkaTask.tryResolveFatJar(DokkaTask.kt:93)

All 6 comments

Could you give me some example project for that, because I can't reproduce this? DokkaTask.configuration should be set automatically when applying the plugin

There you go: https://github.com/mpe85/dokka-test

I guess it happens because I use gradle subprojects.
In the root project I specify the plugin version without actually applying the plugin (to root):

plugins {
    kotlin("jvm") version "1.3.50" apply false
    id("org.jetbrains.dokka") version "0.10.0" apply false
}

In some of my subprojects I apply the plugin, the version is then inherited from the definition in the root project:

plugins {
    java
    kotlin("jvm")
    id("org.jetbrains.dokka")
}

By the way: If I remove configuration { } from the dokka task the 'Failed to apply plugin' error does not show up, but instead I get a stack overflow when running the dokka task:

Cause: java.lang.StackOverflowError
    at org.gradle.api.artifacts.ResolveException.buildMessage(ResolveException.java:36)
    at org.gradle.api.artifacts.ResolveException.<init>(ResolveException.java:32)
    at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException.<init>(DefaultLenientConfiguration.java:345)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1258)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2200(DefaultConfiguration.java:139)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1233)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getFiles(DefaultConfiguration.java:491)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getFiles(Unknown Source)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolve(DefaultConfiguration.java:481)
    at org.jetbrains.dokka.gradle.DokkaTask.tryResolveFatJar(DokkaTask.kt:91)
    at org.jetbrains.dokka.gradle.DokkaTask.tryResolveFatJar(DokkaTask.kt:93)

The stack overflow error is because you don't have jcenter() in the repositories{} block, since dokka is not being published to the Maven Central.
As for the configuration, the problem is with the Gradle build cycle. You have to configure dokka tasks after the dokka plugin has been applied, so I propose a fix like this:

subprojects {
    apply(plugin="org.jetbrains.dokka")
    tasks {
      ...
        withType<DokkaTask> {
            outputFormat = "html"
            configuration {
            }
        }
    }

It also works when I put the configration { } block into a doFirst { } block.

tasks.withType<DokkaTask> {
  outputFormat = "html"
  doFirst {
    configuration {
    }
  }
}

Yes, that's true. I don't know however if we can do something about it, since we have to create the extension during the plugin application. I'll look into that

I'm facing a similar problem and can't figure out the correct configuration. With Dokka 0.9.18, the setup looks like this:

// build.gradle.kts
plugins {
  kotlin("jvm") version versions.kotlin apply false
  id("org.jetbrains.dokka") version versions.dokka apply false
}

// kotlinpoet/build.gradle.kts
plugins {
  kotlin("jvm")
  id("org.jetbrains.dokka")
}

afterEvaluate {
  tasks.named<DokkaTask>("dokka") {
    skipDeprecated = true
    outputDirectory = "$rootDir/docs/1.x"
    outputFormat = "gfm"
  }
}

0.10.0 moved the skipDeprecated option under configuration {}, but I can't get it to build by simply adding the block around skipDeprecated:

kotlinpoet/build.gradle.kts:38:5: Unresolved reference: configuration

Would appreciate any help in getting this to work.

Was this page helpful?
0 / 5 - 0 ratings