Hi there, I've adopted some of my opensource kotlin projects to publish to maven-central using maven...
h
Hi there, I've adopted some of my opensource kotlin projects to publish to maven-central using maven-publish and io.codearte.nexus-staging plugin. However, now I'm stuck migrating my newer bits and pieces that use a build.gradle.kts because I still can't wrap my head around how to translate gradle to gradle-kts. Is there a minimalistic example which I could use as template instead?
g
I’ve done exactly what you’re asking for here: https://github.com/cortinico/kotlin-android-template/pull/31
Specifically with a precompiled script plugin
j
The authors of these two plugins have combined their effort to create a single one doing everything the two plugins did. I use it here, for example: https://github.com/Ninja-Squad/DbSetup/blob/master/build.gradle.kts.
☝️ 1
h
Thx for the pointers and the prompt support.
@jbnizet what happened to artefact signing? I thought this is mandatory for central publishing but seems missing in the process. I've followed the migration guide and declared just
stagingProfileId
but this fails with
Copy code
> No value has been specified for property 'repository.nexusUrl'.
> No value has been specified for property 'repository.snapshotRepositoryUrl'.
Do you have an idea what could go wrong? I have no clue about the URLs, all I know is my staging-profile-id.
j
Regarding your error, it’s hard to explain without seeing your code. Are you sure you applied the new plugin, and removes the two old ones?
h
Credentials are stored in ~/.gradle/gradle.properties and seem to be picked up correctly.
j
Don’t create a new repo. Use the built-in sonatype closure, as explained in the README, and shown in my linked example: https://github.com/Ninja-Squad/DbSetup/blob/master/build.gradle.kts
h
@jbnizet Thanks to your wonderful and generous help, I managed to sign and release it to central https://repo.maven.apache.org/maven2/com/github/holgerbrandl/kalasim/0.6.4/ Thanks a ton!
🎉 1