https://kotlinlang.org logo
Title
d

Dariusz Kuc

05/30/2020, 7:34 PM
hello! any idea why publish to sonatype would not include my custom gradle plugin.jar? I’m publishing to both Maven Central (through
publish
) and Plugin Portal (
publishPlugin
) and while last publish was successful I only got pom, module, javadoc and sources (from default maven publication) but no jar (in sonatype). My root project config: https://github.com/ExpediaGroup/graphql-kotlin/blob/master/build.gradle.kts#L172 <- I’m explicitly configuring 
mavenJava
 publication for all projects except Gradle plugin as it explicitly creates its own 
pluginMaven
 publication. Gradle plugin config: https://github.com/ExpediaGroup/graphql-kotlin/blob/master/plugins/graphql-kotlin-gradle-plugin/build.gradle.kts
publishToMavenLocal
 correctly publishes the plugin jar so it would appear that 
pluginMaven
 publication already contains the jar -> any ideas?
anyone got an example of publishing custom Gradle plugin to both Sonatype and Plugin Portal?
g

gammax

05/31/2020, 5:41 PM
Just out of curiosity: why are you interested in publishing a plugin to Sonatype? Isn’t Gradle Portal already enough?
d

Dariusz Kuc

05/31/2020, 5:54 PM
Afaik Gradle Portal would cover most of the use cases but there are some fringe cases (eg private artifactories that only sync to Maven Central - you would specify dependency on plugin in buildscript) that might not work
Also consistency - all other libs in the project are published to sonatype
a

Arun

05/31/2020, 8:16 PM
Instead of creating a new publication
mavenJava
you can simply override details of the publication the java-gradle-plugin will be creating. I think it's called
pluginMaven
.
d

Dariusz Kuc

05/31/2020, 8:47 PM
Yep thats what I do (default mavenJava is created for all other libs)
(Originally wasnt and was hitting a sonatype error as both auto generated pluginMaven and my mavenJava publication were generating jar with same coordinates)
turns out it looks like some quirk with sonatype search, actual jars are getting published https://repo1.maven.org/maven2/com/expediagroup/graphql-kotlin-gradle-plugin/3.0.0-RC8.2/
😕