Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

已关闭 适合新手
#3,099 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
java
领域
build-system

调研方向

从 GradleProvisioner.java 开始,重点检查第 136 行附近的 forConfigurationContainer,并检查 JarState.provisionWithTransitives 使用的 detached configuration 设置。使用 warning-mode all,通过 spotlessCheck 和 spotlessApply 运行提供的 Gradle 9.8 复现。完成的标准是 formatter provisioning 仍然成功,且不再出现 Configuration.setVisible(boolean) 的弃用警告。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Java
星标
5.7k
派生
563
平均合并
1 天 8 小时
30 天内合并 PR
52

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

diffplug/spotless 的其他 Issue

查看 diffplug/spotless 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。