Actually no, sorry, it doesn’t seem to work that way. I tried it locally. If you publish only the
common artifact of the library and then try to use it in an MPP client with a JVM target, you will get a compilation error, something like this:
> Task :compileKotlinJvm FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlinJvm'.
> Could not resolve all files for configuration ':jvmCompileClasspath'.
> Could not resolve belkov.inner:inner-metadata:0.0.1.
> Unable to find a matching variant of belkov.inner:inner-metadata:0.0.1: Variant 'metadata-api':
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'.
- Required org.jetbrains.kotlin.platform.type 'jvm' and found incompatible value 'common'.
So the JVM library artifact must also be published in order to consume the library with a JVM client.