I have one Gradle project which includes two sub p...
# multiplatform
s
I have one Gradle project which includes two sub projects:
lib
and
sample
. The library uses some dependencies (ktor for instance). They all are declared as
implementation
dependencies. My sample should simply use the
lib
as a dependency. For this i added
Copy code
commonMainImplementation(project(":lib"))
But if I run my
jvm
sample (which has a
main
method) I get:
java.lang.NoClassDefFoundError: io/ktor/client/HttpClientJvmKt
Which is strange because I do not share the
HttpClient
as a API. It is declared as
internal
and therefore it should not be shared with other libraries... To my question: Is this setup possible? How should it work then? How do I have to declare my lib dependency in the sample?
c
Looks like no transitive dependencies added to the claaspath so it doesn't want to work. Try to add the lib dependency to the jvm source set
s
I tried this as well, but without success… But why aren’t they added? I mean they are dependencies from the jvm target at my lib. So it should be added, right?
When I look at some other Multiplatform libraries at GitHub; it seems that everyone put the sample in its own gradle project (with a settings.gradle.kts etc). But i think this is not the right way…
I was running into this issue: https://youtrack.jetbrains.com/issue/KT-29082