christophsturm
12/01/2023, 12:51 PMAnton Prokhorov
12/01/2023, 4:37 PMjvm platform built-in publish task will publish 2 publications:
• kotlin metadata artifact with default coordinates
• separate jvm artifact with -jvm suffix
Until your jvm library is supposed to be consumed by gradle or amper, you are already good to go (gradle dependency resolution mechanism knows how to treat multiplatform libraries and how to use only jvm-part even in java-based projects, because kmp tooling relying on variant-aware dependency resolution mechanism)
To change artifactId you could set up project name in settings.gradle.kts
// settings.gradle.kts
// rootProject.name = "new-shiny-artifactId"
project(":subproject").name = "new-shiny-artifactId"
groupId and version you could set up in build.gradle.kts
// build.gradle.kts
group = "org.jetbrains.publication-example"
version = "1.0"
However, if you want to publish your library like a regular jvm library, you could just publish only jvm part, but to get rid of -jvm suffix in coordinates, I'd propose to just override artifactId field in jvm publication like this:
// build.gradle.kts
publishing {
publications {
(findByName("kotlinMultiplatform") as MavenPublication).artifactId = "artifact-id"
}
}christophsturm
12/01/2023, 5:56 PMAnton Prokhorov
12/01/2023, 6:00 PMplugins section in your build.gradle.kts and add plugin you need, I don't know how this publish plugin works, but I suspect it gets data from PublishingExtension anywaychristophsturm
12/01/2023, 6:01 PMAnton Prokhorov
12/01/2023, 6:03 PMhow do I set the credentials?by the same way as you are used to