Documentation on kotlin modules, libraries or packaging

Could anyone point me to the documentation on kotlin artifacts packaging please?

The only source I see is
and It looks like what is described at this page is relevant to native only.

I am interested in getting answer to a very simple question: can I write a piece of kotlin logic (common or multipatform), build an artifact, publish it in an repo like maven and have then an ability to add this artifact as dependency to another project (common or multiplatform)?

Here is some extra information
but description is very scarce :frowning:

You are right, information on publication is scarce!
The reason is due to the fact that publication is demanded to Gradle and the way you create a publication is not actually tight to Kotlin at all!

With Gradle you can create so called publications and publish them wherever, Maven, Ivy, you name it.

To publish on a Maven repository you can use the maven-publish plugin which adds the tasks and DSL to do so.

When using Kotlin/Multiplatform and applying maven-publish, the Kotlin plugin will generate those MavenPublication for you (when using K/JVM you have to declare them yourself, not sure if a bug or intended).

Also the way you configure a MavenPublication depends on what parts of your build you want to publish and on which Maven repository.

Maybe the very easiest way would be to use, I started there knowing almost nothing of Gradle! Otherwise go for the gradle-bintray-plugin from Bintray itself! On Bintray yuo can create a public Maven repository and publish there your artifacts!

Beware, many of the guides you will find will use Groovy as language for Gradle scripts. I encourage new programmers to go with Kotlin since it’s way less ambiguous and easier to understand at a first glance.

Thanks for assistance. I’ve managed to publish my mpp libraray to local maven but I cannot use it in consumer project :frowning: as the consumer project does not see it!

Here is illustration of the problem:

I will be extremely gratefull for any help!

P.S. Both LibX and LibXConsumer in example are multi-module projects to better reflect what I am dealing with in my real work. (They contain a single module each)

Here is a lib class:

package libx

open class LibXBaseClass(val name: String)

Here is the snippet that publishes the lib:

kotlin {
    configure([targets["metadata"], jvm(), js()]) {
        mavenPublication { targetPublication ->
                    .matching { it.publication == targetPublication }
//                .all { onlyIf { findProperty("isMainHost") == "true" } }

version = '1.0'
group = 'i_need_help_example'

subprojects {

    // maven publication
    apply plugin: 'maven-publish'

    publishing {
        repositories {

        publications {

            maven(MavenPublication) {
                version rootProject.version


Here is how it is imported as dependency:

sourceSets {
    commonMain {
        dependencies {
            implementation 'i_need_help_example:LibX:1.0'
            implementation kotlin('stdlib')
            implementation kotlin('stdlib-common')

This is what I am getting (dependency is resolved but empty):

Eventually I have managed to make it work myself. But I hardly can explain how and what was the reason…

Anyway my repository now contains working example. Those who experience similar problems - feel free to use.