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)?
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 JitPack.io, 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 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)