我在项目中使用libs.version.toml
,并添加了以下内容
[versions]
spotless = "6.13.0"
[libraries]
spotless-gradlePlugin = { group = "com.diffplug.spotless", name = "spotless-gradle-plugin", version.ref = "spotless" }
[plugins]
spotless = {id = "com.diffplug.spotless", version.ref = "spotless"}
然后在build.gradle
的build-logic
中有这个
plugins {
`kotlin-dsl`
}
group = "com.mygroup.buildlogic"
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
repositories {
google()
mavenCentral()
}
dependencies {
compileOnly(libs.spotless.gradlePlugin)
}
....
但我得到这个错误
build-logic:main: Could not find com.diffplug.spotless:spotless-gradle-plugin:6.13.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/diffplug/spotless/spotless-gradle-plugin/6.13.0/spotless-gradle-plugin-6.13.0.pom
- https://repo.maven.apache.org/maven2/com/diffplug/spotless/spotless-gradle-plugin/6.13.0/spotless-gradle-plugin-6.13.0.pom
Required by:
project :build-logic
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
我错过了什么?
1条答案
按热度按时间f0ofjuux1#
您需要将
gradlePluginPortal()
添加到repositories
块中