Sources for MPP library

Hi,

I’m writing an MPP library (JVM, JS targets) which I like to publish to a public repository eventually. As of now I publish it to mavenLocal to use it from other projects (those are MPP as well).

However, I cannot see the source codes (not JVM nor JS) from the other projects. The actual library works well.

More precisely: I cannot see them with the standard gradle import.

plugins {
    kotlin("multiplatform") version "1.4.0"
    kotlin("plugin.serialization") version "1.4.0"
    `maven-publish`
}

group = "hu.simplexion.zakadabar"
version = "2020.8.21-SNAPSHOT"

val stackVersion = "2020.8.21-SNAPSHOT"
val editorVersion = "2020.8.21-SNAPSHOT"

repositories {
    mavenCentral()
    jcenter()
    mavenLocal()
}

kotlin {

    jvm()

    js {
        nodejs()
    }

    sourceSets {
        commonMain {
            dependencies {
                api("hu.simplexion.zakadabar:zakadabar-stack:$stackVersion")
                api("hu.simplexion.zakadabar:zakadabar-editor:$editorVersion")
            }
        }
        
        get("jvmMain").dependencies {
            implementation(kotlin("stdlib-jdk8"))
        }
    }

It works when I go to Project Structure and add them manually like this:

I’ve spent a few hours trying to figure out whats wrong, checked a few other projects like Ktor, kotlinx.html, how they do it. No luck so far.

My only guess is that it’s because of mavenLocal but that’s really just a guess.

I’m a bit worried to publish the library like this as not having the sources would be a major drawback.

Thanks in advance,

1 Like

I noticed the same problem when the mpp library is published to maven local. But it work’s fine when the same artifacts are published and used from the remote maven repository (e.g. bintray).

2 Likes