somehow in our project kotlinx-serialization-json ...
# javascript
n
somehow in our project kotlinx-serialization-json resolves to its jvm variant dependecies task spits out this snippet:
Copy code
jsCompileClasspath - Compile classpath for compilation 'main' (target js (js)).
+--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10
|    \--- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlinx:kotlinx-serialization-json:{require 1.3.2; reject _} -> 1.3.2
|    \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.3.2
anyone ran into this or got a idea how to figure out whats causing it ?
v
Maybe the
dependencyInsight
task can help. Afair it also shows information about the selected variant and maybe why. Don't remember exactly right now.
n
still not sure why it picks that variant.. and such..
it is as if it somehow tries the -jvm variant and then is surprised that it has no js variantsi n there..
v
Hm, first suspicion, I see in the scan that the lib is taken from
mavenLocal
. Don't use
mavenLocal
, it is broken by design. It is a mixture of download cache and repository of Maven. If you for example just resolve a POM or just some artifacts of a dependency using Maven, then only these artifacts are in the maven local and when later Gradle sees it, it sees a "corrupt" state that might not work properly. If you ever really need
mavenLocal
, then at most use it with a content repository filter in which you define exactyl which dependency you want to take from there from which you know it is properly in there because you deployed it in there manually.
n
i will make sure to add a content filter and see if if the problem persists..
yep.. this fixed it:
Copy code
mavenLocal() {
    content {
        includeModule("com.tryformation", "api-client")
    }
}
v
Great, then it was probably exactly what I thought, a half-cached state of the dependency. Is
com.tryformation:api-client
a Maven build, or why do you use it through
mavenLocal
?
n
because i am developing on 2 things at once.. and trying to make the PR on our webapp before publishing the api change.. in case it runs into issues..
i could probably publish it to a "local" maven in a different folder and avoid issues with other things being in mavenLocal too..
v
Yes, that's also an option, but would you mind answering my question, then I maybe have an even much better option for you. Is it a Maven build, or is it a Gradle build?
If the former, then using a local repo like maven local or another dedicated one is the way to go. But if the latter, then I highly recommend you use composite builds instead. Then you get both projects automatically in the IDE when opening the consumer project and if you build the consumer, the provider is built automatically if necessary.