Unable to publish plugin, due non-explicit dependency


(Dmitry Jemerov) #1

I need to publish another artifact with the plugin, to use it as the dependency.

So configuration like:

org.jetbrains.dokka/dokka-fatjar/dokka-fatjar.jar // not a plugin itself, but dependency for it
org.jetbrains.dokka/dokka-fatjar/dokka-fatjar.pom  
org.jetbrains.dokka/dokka-gradle-plugin/dokka-gradle-plugin.jar // depends on dokka-fatjar and resolving dependency when plugin applied, so no explicit dependency in .pom and gradle config itself 
org.jetbrains.dokka/dokka-gradle-plugin/dokka-gradle-plugin.pom

Seems it not possible with current Gradle plugin publish plugin.

Please help!


(Tom Dunstan) #2

Hi Dmitry!

Sorry, it’s not currently possible to publish non-plugin artifacts on the portal (other than things relating to them like source jars etc).

There are two potential workarounds:

  • Publish the dependency to e.g. JCenter. You can then refer to it in a plugin that is applied to a project using the plugins {} DSL, as the portal will redirect any artifact references that it doesn’t understand to JCenter.

  • Make the plugin jar a fat jar too and include everything from the other fat jar inside it.

Which strategy you go for will depend on whether there are other potential consumers for the other jar, whether the two are released together or separately etc.

If you wish to go the fat jar route, we do this with our own plugins and so I can give you some example code for getting a far jar published to the portal correctly.

Hope that helps

Regards

Tom


(Dmitry Jemerov) #3

Thank you! Will try to apply the first approach.

There is no possibility to use the second since Dokka uses the separate classloader to load it’s fat jar especially to prevent interference between Gradle and bundled Kotlin compiler.