Gradle "settings file ... evaluation failed" - Fix settings.gradle in CI
Gradle failed while evaluating settings.gradle(.kts) - the very first script it runs. A syntax error, a bad include, or a malformed pluginManagement/dependencyResolutionManagement block stops the build before any project is configured.
What this error means
The build fails immediately with a settings-file error: Could not compile settings file or settings file '.../settings.gradle' line: N ... evaluation failed, pointing at the offending line.
FAILURE: Build failed with an exception.
* Where: Settings file '/workspace/settings.gradle.kts' line: 12
* What went wrong:
Could not compile settings file '/workspace/settings.gradle.kts'.
> Unresolved reference: gradlePluginPortlCommon causes
Syntax error or typo in settings
A misspelled method (gradlePluginPortl), a missing brace, or invalid Kotlin/Groovy in settings.gradle fails to compile, so Gradle cannot start.
Bad include or repository-management block
An include(":missing-module") for a directory that does not exist, or a malformed dependencyResolutionManagement { repositories { ... } }, makes settings evaluation throw.
How to fix it
Fix the line the error points at
The line: N and the compile message name the exact problem. Correct the typo or the block.
// settings.gradle.kts
pluginManagement {
repositories { gradlePluginPortal() } // not gradlePluginPortl
}
rootProject.name = "app"
include(":core", ":api") // each must be a real directoryValidate includes and repositories
- Confirm every
include(":x")maps to an existing directory. - Check
dependencyResolutionManagement/pluginManagementblocks are well-formed. - Run
./gradlew helpto evaluate settings without running a real task.
How to prevent it
- Keep settings.gradle minimal and validate it with
./gradlew help. - Use the IDE/Kotlin DSL completion to avoid method typos in settings.
- Ensure included module directories exist before referencing them.