After migrating from Groovy to Kotlin DSL the settings.gradle
is now getting a lint warning about the usage of this code
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url = uri("https://jitpack.io")
}
}
Currently using AGP 8.1.3
Even when creating a new project using the IDE's template that is in Kotlin DSL, the above configuration exist and also got warning.
Why this is not showing when using Groovy, it seems there is an issue with Kotlin DSL or the lint just cannot detect it when in Groovy?
If you convert the
dependencyManagement {}
block back toGroovy
DSL and try to navigate torepository
handler, for example, you end up in the same file with same@Incubating
annotations: https://github.com/gradle/gradle/blob/master/subprojects/core-api/src/main/java/org/gradle/api/initialization/resolve/DependencyResolutionManagement.java#L44But why does it show warnings for Kotlin but not for Groovy? According to this answer in the Gradle GitHub repo: https://github.com/gradle/gradle/issues/20328#issuecomment-1083788360
The problem is not with Gradle. It's the way
Intellij
-based IDEs run their inspections on.gradle
and.kts
files. TheUnstable API usage
inspection not working for.gradle
files for some reason.Seems like to make it work
IntelliJ
guys should add it to theGradle
sections in their Inspection catalog. As for now, seems like it can handle only@Deprecated
annotation