I wrote a gradle plugin with some utility functions for declaring repositories (that’s why I want to put in the settings.gradle.kts). The problem is, as soon as I add it to the plugins-block in the settings.gradle.kts I get this error message for the global build.gradle.kts:
Error resolving plugin [id: 'org.jetbrains.kotlin.android', version: '2.0.0', apply: false]
> The request for this plugin could not be satisfied because the plugin is already on the classpath with an unknown version, so compatibility cannot be checked.
My plugin is in my local maven repository. Putting the dependency in a buildscript block results in the same error message.
The build.gradle of the plugin:
plugins {
kotlin("jvm") version embeddedKotlinVersion
`maven-publish`
`kotlin-dsl`
}
repositories {
mavenCentral()
gradlePluginPortal()
google()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0")
api("org.jfrog.buildinfo:build-info-extractor-gradle:5.2.3")
testImplementation(kotlin("test"))
}
kotlin {
jvmToolchain(17)
}
...
And the settings.gradle.kts of the using project:
pluginManagement {
repositories {
google {
content {
includeGroupByRegex("com\.android.*")
includeGroupByRegex("com\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
mavenLocal()
}
}
plugins {
id("my-plugin-id") version "1.0-SNAPSHOT" //adding this causing the error message
}
Relevant part of the global build.gradle.kts:
plugins { //error is reported for this line
alias(libs.plugins.android.application) apply false
alias(libs.plugins.jetbrains.kotlin.android) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.compose.compiler) apply false
alias(libs.plugins.jfrog) apply false
alias(libs.plugins.ktlint)
}
Any help is welcome 🙂
Jimedem is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.