Hey all, so I've had this issue happen on both a p...
# gradle
j
Hey all, so I've had this issue happen on both a personal project now and our work project where we just brought kotlin multiplatform in, but local builds will build fine but it specifically fails on CI, I've seen this same error happen in a github action and gitlab CI environment when trying to go from kotlin
1.7.10
to
1.7.20
but the stack trace hasn't been super helpful into hunting down exactly why the CI can't find
1.7.20
attaching stack trace in thread:
Copy code
> Configure project :shared
Kotlin Multiplatform Projects are an Alpha feature. See: <https://kotlinlang.org/docs/reference/evolution/components-stability.html>. To hide this message, add 'kotlin.mpp.stability.nowarn=true' to the Gradle properties.
Build was configured to prefer settings repositories over project repositories but repository 'ivy' was added by build file 'shared/build.gradle.kts'
Please wait while Kotlin/Native compiler 1.7.20 is being installed.
Download <https://download.jetbrains.com/kotlin/native/builds/releases/1.7.20/linux-x86_64/kotlin-native-prebuilt-linux-x86_64-1.7.20.tar.gz> (178.82 MB)
FAILURE: Build failed with an exception.
* Where:
Build file '/builds/hearsee/android/shared/build.gradle.kts' line: 15
* What went wrong:
Could not resolve all dependencies for configuration ':shared:detachedConfiguration3'.
The project declares repositories, effectively ignoring the repositories you have declared in the settings.
You can figure out how project repositories are declared by configuring your build to fail on project repositories.
See <https://docs.gradle.org/7.5/userguide/declaring_repositories.html#sub:fail_build_on_project_repositories> for details.
> Could not find :kotlin-native-prebuilt-linux-x86_64:1.7.20.
  Required by:
      project :shared
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at <https://help.gradle.org>
BUILD FAILED in 1m 30s
Well I bumped it to
1.7.21
and did a couple other changes like removing
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
and bumping the gradle wrapper version from 7.5 back to 7.4. So not sure exactly which of these changes fixes this mysterious issue, but it's odd I keep seeing it specifically only in CI environments.
t
you need to remove
repositoriesMode
allowing project defined repositories to work. Let me find related issue
j
Shouldn't
PREFER_SETTINGS
avoid the issues that
FAIL_ON_PROJECT_REPOS
causes?
In my experience it doesn't seem to help flipping that switch, but I'm also not confident the actual issue was related to the repositoriesMode
t
From
PREFER_SETTINGS
docs:
If this mode is set, any repository declared directly in a project, either directly or via a plugin, will be ignored.
j
Ah, I should've read into that a bit more, that makes sense. So even if that flag is that, it will cause the ivy repository to not be found?
t
yes
j
Good to know, thanks!
704 Views