Problem setting spotless gradle plugin using toml

516 Views Asked by At

I'm using a libs.version.toml on my project and I've added this

[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"}

Then in my build.gradle of my build-logic I have this

plugins {
    `kotlin-dsl`
}
group = "com.mygroup.buildlogic"

java {
    sourceCompatibility = JavaVersion.VERSION_11
    targetCompatibility = JavaVersion.VERSION_11
}

repositories {
    google()
    mavenCentral()
}

dependencies {
    compileOnly(libs.spotless.gradlePlugin)
}
....

But I'm getting this error

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

What I'm missing?

1

There are 1 best solutions below

0
On

You need to add gradlePluginPortal() to the repositories block

repositories {    
    gradlePluginPortal()
    google()
    mavenCentral()
}