https://kotlinlang.org logo
Title
l

LastExceed

04/04/2020, 9:33 AM
I am trying to publish my first library to MavenCentral, but i have trouble figuring out how to do it. I followed this guide: https://central.sonatype.org/pages/ossrh-guide.html to create whatever this is: https://issues.sonatype.org/browse/OSSRH-56105 then i tried to configure Gradle with these instructions: https://central.sonatype.org/pages/gradle.html which turn out to be outdated according to this documentation: https://docs.gradle.org/current/userguide/publishing_setup.html so i'm trying to follow that instead, but this documentation isn't very helpful. It suggests using the
publishing {}
block which isn't even possible (workaround here: https://stackoverflow.com/questions/54654376/why-is-publishing-function-not-being-found-in-my-custom-gradle-kts-file-within ) and doesn't give me any information on how to configure it for a kotlin project. can someone help me? maybe someone has a working project setup that i can look at ? I am completely lost
TLDR I've used maven-publishing, signing, nexus-staging and nexus-publish plugins
If you are publishing single lib and dont care about automatic release then you can skip the last two
m

mbonnin

04/05/2020, 2:01 PM
+1. You really want to use the
maven-publishing
plugin. If you can't use the
publishing {}
block, that's most likely because you're using the "old"
apply
method for your plugins instead of the
plugins
block but you can still do the same by using
configure<PublishingExtension> {}
instead of
publishing {}
2