Hello :wave: Anyone knows how Gradle determines pr...
# gradle
d
Hello 👋 Anyone knows how Gradle determines proper platform Kotlin module? i.e. what determines that Gradle picks up
-jvm
artifacts (e.g. given
io.ktor:ktor-client-cio
we expect
io.ktor:ktor-client-cio-jvm
to be picked up on JVM builds)?
v
I guess by using the published Gradle metadata and variant-aware attribute-based resolution
d
any idea what could break this resolution?
v
break how?
since individual modules run correctly up to the Gradle plugin integration tests it somewhat points at the
GradleRunner
getting confused
v
It more sounds like the Gradle Module metadata file is missing.
Maybe you somehow get the lib into your maven local repository but without the module metadata and have
mavenLocal()
as repository?
Then if the lib is in the maven local repo but without the module metadata, the resolution will fail
But if the lib is not present in the maven local repo, then the next repositories are searched and then the one on maven central with the module metadata is found
Just a wild guess though without having a look at your build
Yep, many mavenLocal references in that repo, whyever
And it always comes first, so if it is found there, it will be used
And with ktor 1.3.1 there was no problem as it didn't yet publish the Gradle Module metadata back then
d
yeah i need maven local for the snapshot resolution for the maven integration tests
interestingly maven integration tests work fine
v
Maven does not use the Gradle Module Metadata
d
my bad missed the
Gradle
part in the module metadata
v
The problem is that you actually do maven integration tests probably, as those fill the maven local repository with the dependency without Gradle module metadata
d
any ideas how to work around this? I guess I could change the repo resolution order
v
Sure two, just searching for the right syntax or link for the second, one moment
One solution would be to put
mavenLocal()
in last position, not in first, as they are searched in order
d
yeah was going to try that
v
The other that comes to my mind would be to use a repository content filter: https://docs.gradle.org/current/userguide/userguide_single.html#sec:declaring-repository-filter
d
👍
awesome! thanks for the help and pointers!
v
With that you can exactly define what is searched for in a repository or is not searched for, so you could for example define that only snapshot versions are taken from maven local
👌 1
yw
d
Thank you!
Just verified it and it works as expected, thanks again