Hey! I'm running into a weird dependency issue whe...
# getting-started
m
Hey! I'm running into a weird dependency issue when targeting android and jvm, I was wondering if any of you guys had come across this. What happens is that when I have a library that is for android and jvm, and I try to import it into a new library (targeting jvm) it does not resolve the commonMain library. I've set up a couple of projects that show the issue - I think its a config issue I'm just blind on, but im stuck • https://github.com/mikedrawz/Lib1https://github.com/mikedrawz/Lib2
a
I believe there is no such thing as an flavoured ‘common’ Kotlin publication. So there’s no way to share common code outside of Lib1 without compiling it to a target. https://youtrack.jetbrains.com/issue/KT-52666/
m
so how would my usage of
kermit
be any different? I'm able to successfully import their logger with
import co.touchlab.kermit.Logger
in Lib2
a
perhaps I’ve misunderstood. Would you mind explaining your question in a different way?
m
my end goal would be to able to create KMM libraries that I could consume in other KMM libraries. The bulk of the code would be common, but some would be native. I guess I'm wondering why I'm able to import a library such as
kermit
but not one that I published
e
are you publishing to mavenLocal? there's issues with that and gradle module metadata, which kotlin multiplatform artifact resolution needs
m
I first noticed the issue when I was working on a project that was adding a library that I had published to a private maven repo - but since I was able to reproduce it with mavenLocal I thought it was a general issue. What is weird though, is that I have some libraries that only target jvm, and they can resolve each other.
e
yes, JVM project dependencies on non-multiplatform JVM projects works fine, it's just consuming Kotlin multiplatform projects published to mavenLocal that has issues
https://kotlinlang.slack.com/archives/C0BT46EL8/p1647621876364509?thread_ts=1647340104.815229&cid=C0BT46EL8 this is my workaround for JVM-only consumers of multiplatform publications
m
ok, after some trial and error and using the hosted repo, I was able to get it to resolve, thx!