Skip to content

[Gradle] Configuration.setVisible(boolean) deprecation warning on Gradle 9.8 #3099

Description

@sanwenyukaochi

Environment

  • Spotless Gradle plugin: 8.10.2
  • Gradle: 9.8.0
  • Reproduced with: spotlessCheck and spotlessApply

Reproduction

A formatter that provisions external dependencies is enough to reproduce it, for example:

plugins {
    id("com.diffplug.spotless") version "8.10.2"
}

repositories {
    mavenCentral()
}

spotless {
    java {
        googleJavaFormat()
    }
}

Run:

./gradlew spotlessCheck --warning-mode all -Dorg.gradle.deprecation.trace=true

Actual behavior

Gradle reports:

The Configuration.setVisible(boolean) method has been deprecated.
This is scheduled to be removed in Gradle 11.

The relevant stack trace is:

at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.setVisible(DefaultConfiguration.java:376)
at org.gradle.api.internal.artifacts.configurations.DefaultLegacyConfiguration_Decorated.setVisible(Unknown Source)
at com.diffplug.gradle.spotless.GradleProvisioner.lambda$forConfigurationContainer$2(GradleProvisioner.java:136)
at com.diffplug.gradle.spotless.GradleProvisioner$DedupingProvisioner.provisionWithTransitives(GradleProvisioner.java:91)
at com.diffplug.spotless.JarState.provisionWithTransitives(JarState.java:132)

In Spotless 8.10.2, GradleProvisioner.forConfigurationContainer configures the detached configuration with:

config.setCanBeConsumed(false);
config.setVisible(false);

I see the warning from formatters that provision external dependencies, including Gherkin, Java (google-java-format), JSON (Gson), and Kotlin (ktlint). The build still succeeds, but Gradle generates a problems report containing the warnings.

Gradle upgrade guide: https://docs.gradle.org/9.8.0/userguide/upgrading_version_9.html#deprecate-visible-property

Expected behavior

Spotless should run on Gradle 9.8 without deprecation warnings and remain compatible when Configuration.setVisible(boolean) is removed in Gradle 11.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions