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

Created on 24 Mar 2017  路  27Comments  路  Source: Kotlin/dokka

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.

Most helpful comment

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>

All 27 comments

Same issue here.

@semoro Did you reopen this issue because the commit you did does not work ?

@mkobit do you have any workaround for this in order to work with gsk ?

nm..manually applying the classpath classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.13") worked.

@sdeleuze Reopened because can't get it working. Basically, I need to publish non-plugin jar to Gradle Plugins repo, will try to figure out how to achieve it later.

Any plans to publish 0.9.14 to Gradle plugin repo?

0.9.15 pushed to plugins repo and seems working, closing issue now

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?

Looks like a bug, interesting, after fix I checked it. Will see again

Is there any update on this? I can't seem to use 0.9.15 or 0.9.13 without having this issue.

Hi @semoro, Gradle engineer here. I'm writing a guide for getting started with Kotlin, and I'd love to include instructions for setting up Dokka with my Kotlin-based build script. I'd prefer to use the plugins {} block for a nice simple example, so I'd like to know how the Gradle team can help us get this solved. My email address is on my GitHub profile if you need it.

Thanks for contributing to this tool.

I'm wondering if this is something similar to https://discuss.gradle.org/t/com-gradle-plugin-publish-does-not-respect-new-java-library-configurations/24041/3

It could also be from 0.9.6 version of plugin (see https://discuss.gradle.org/t/plugin-authors-please-use-the-latest-plugin-publish-plugin-others-may-result-in-a-broken-upload/23573)

@semoro have you had the occasion to chat with @eriwen ?

I have been getting this too .

`* What went wrong:
A problem occurred configuring root project 'ktor'.

Could not resolve all files for configuration ':classpath'.
Could not find org.jetbrains.dokka:integration:0.9.15.
Searched in the following locations:
https://packages.atlassian.com/maven/repository/internal/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
https://packages.atlassian.com/maven/repository/internal/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
https://jcenter.bintray.com/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
https://jcenter.bintray.com/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
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
http://dl.bintray.com/kotlin/kotlin-eap-1.2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
http://dl.bintray.com/kotlin/kotlin-eap-1.2/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
http://dl.bintray.com/kotlin/kotlin-dev/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.pom
http://dl.bintray.com/kotlin/kotlin-dev/org/jetbrains/dokka/integration/0.9.15/integration-0.9.15.jar
Required by:
project : > org.jetbrains.dokka:dokka-gradle-plugin:0.9.15`

@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?

Agreed that this is still broken and Dokka is presently unusable from gradle

" > Could not find org.jetbrains.dokka:integration:0.9.15."

@madorb in the mean time you can use @koral--'s workaround

Interestingly, we use an internal nexus instance that proxies jcenter, and that still fails for me. hm

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()
  }
}

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>

This issue is even more critical with Gradle 4.4 (it broke Spring build). Is that possible to fix 0.9.15 Gradle portal plugin POM or to release 0.9.16 in order to fix the double POM problem ?

This issue has intermittently broken a few builds of mine today, strange. Even saw a recovery once.

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.

+1. Any update on this? the workaround does not work for me

I too have this issue. Tried both (not at the same time) using _classpath_ and the _plugins_ notation. None of them worked, downgrading to Gradle 4.3 did work for me, all tough that is of course not a long term solution.

The problems seems to be a bit inconsistent. I do not have this problem on my own machine but for example JitPack does not work with Dokka and Gradle 4.4.

Same issue here.

Fixed in 0.9.16

Was this page helpful?
0 / 5 - 0 ratings

Related issues

norswap picture norswap  路  4Comments

hamza1311 picture hamza1311  路  5Comments

xit0c picture xit0c  路  4Comments

martinkocjan-tomtom picture martinkocjan-tomtom  路  6Comments

fschoellhammer picture fschoellhammer  路  4Comments