dokka: Gradle plugin portal publishing can't find all dependencies?

There is a dokka plugin available on the Gradle plugin portal - https://plugins.gradle.org/plugin/org.jetbrains.dokka .

Both usages on the documentation do not work:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.jetbrains.dokka:gradle-plugin:0.9.13"
  }
}

apply plugin: "org.jetbrains.dokka"

and

plugins {
  id "org.jetbrains.dokka" version "0.9.13"
}

Both of these fail with:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'dokka-plugin-portal'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not find org.jetbrains.dokka:integration:0.9.13.
     Searched in the following locations:
         https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.13/integration-0.9.13.pom
         https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.13/integration-0.9.13.jar
     Required by:
         project : > org.jetbrains.dokka:gradle-plugin:0.9.13

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1.247 secs

The first example is different than that in the current Readme.

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
    }
}

apply plugin: 'org.jetbrains.dokka'

The classpath dependency for the buildscript points to org.jetbrains.dokka:dokka-gradle-plugin instead of that from the plugin portal which is org.jetbrains.dokka:gradle-plugin.

I wasn’t sure if the plugin portal was supported because I don’t see it in the documentation, but didn’t see another issue for this.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 22
  • Comments: 27 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Looks like org.jetbrains.dokka:dokka-gradle-plugin gets deployed with two different POMs:

JCenter version (link):

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.jetbrains.dokka</groupId>
  <artifactId>dokka-gradle-plugin</artifactId>
  <version>0.9.15</version>
  <dependencies>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-runtime</artifactId>
      <version>1.0.7</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-reflect</artifactId>
      <version>1.0.7</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>

Plugin portal version (link):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd
" xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.jetbrains.dokka</groupId>
  <artifactId>dokka-gradle-plugin</artifactId>
  <version>0.9.15</version>
  <dependencies>
    <dependency>
      <groupId>org.jetbrains.dokka</groupId>
      <artifactId>integration</artifactId>
      <version>0.9.15</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
  </dependencies>
</project>

Fixed in 0.9.16

Please consider releasing a new version. The different POM issue brought up above by @lptr causes issues with Gradle in the workaround I posted above if gradlePluginPortal() is searched before jcenter() because of the broken POM.

A workaround for treating it like a plugins {} dependency can be done if you want to switch to the newer plugin style.

Here is an example using Gradle 4.4-rc-6 (using 4.4 because pluginManagement.repositories was switched to RepositoryHandler, which includes the jcenter()/mavenCentral() shortcuts):

// build.gradle/build.gradle.kts
plugins {
  id("org.jetbrains.dokka") version "0.9.15"
}

// settings.gradle/settings.gradle.kts in 4.4
pluginManagement {
  resolutionStrategy {
    eachPlugin {
      if (requested.id.id.startsWith("org.jetbrains.dokka")) {
        useModule("org.jetbrains.dokka:dokka-gradle-plugin:${requested.version}")
      }
    }
  }
  repositories {
    // repository ordering matters because of broken POM mentioned in https://github.com/Kotlin/dokka/issues/146#issuecomment-350272436
    jcenter()
    gradlePluginPortal()
    mavenCentral()
  }
}

There is still an issue with 0.9.15:

> Could not resolve all files for configuration ':foo:classpath'.
   > Could not find org.jetbrains.dokka:integration:0.9.15.
     Searched in the following locations:
         https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
         https://plugins.gradle.org/m2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
     Required by:
         project :foo > org.jetbrains.dokka:dokka-gradle-plugin:0.9.15

It seems that org.jetbrains.dokka:integration:0.9.15 is not published to Gradle Plugins repo.

Workaround is to add for example jcenter() repo:

allprojects {
    buildscript {
        repositories {
            jcenter()
        }
    }
}

Is it intended or a bug?

@eriwen, if you’re still keen on helping. I think I might have found something.

As of now, the plugin is published in (at least) two different places: https://plugins.gradle.org/m2/org/jetbrains/dokka/dokka-gradle-plugin/0.9.15/ https://jcenter.bintray.com/org/jetbrains/dokka/dokka-gradle-plugin/0.9.15/

Looking at the archives, both of them are exactly the same, but somehow the accompanying pom file is different. In the plugins.gradle.org repository the pom file indicates a dependency on integration (which is never published anywhere, it’s always shadowed), but not on kotlin-runtime nor kotlin-reflect. In the jcenter version, we have two dependencies, one on kotlin-runtime, the other on kotlin-reflect, both being declared specifically as shadowed though.

https://github.com/Kotlin/dokka/blob/0.9.15/runners/gradle-plugin/build.gradle#L21-L24

So to summarise, reflect and runtime are shadowed but somehow seen as dependencies in jcenter, integration isn’t marked as shadowed but somehow is and is only seen as a dependency in gradle.org.

Any idea of what’s going on here?