Remove deprecated Configuration.setVisible(boolean) call (Gradle 9.8) - #271
Conversation
The per-project producer configuration called `isVisible = false`, which Gradle deprecated in 9.8.0-milestone-2 (scheduled for removal in Gradle 11). Builds that fail on deprecation warnings (`org.gradle.warning.mode=fail`) break as soon as a project applying the nmcp plugin is configured. The `visible` property no longer has any meaningful effect on the build, and the internal `nmcpProducer` configuration is already kept out of resolution via `canBeConsumed=true`/`canBeResolved=false`, so the call can be removed without changing behaviour on any supported Gradle version.
|
Thanks for sending this!
IIRC, without I'd feel much safer if we put this behind a big |
|
@martinbonnin I can do that. I'll also follow up with the gradle team about this finding. Thanks! |
Per review feedback: keep the `isVisible = false` behaviour on Gradle versions where it still matters (so publications aren't published as part of `assemble`), and only skip it on Gradle 9.8+ where the property is deprecated and inert. This avoids the deprecation warning on 9.8+ while preserving the original behaviour on older Gradle versions.
Per review feedback on the equivalent nmcp change (GradleUp/nmcp#271), keep the visible=false behaviour on Gradle versions where it still matters and only skip it on Gradle 9.8+ where Configuration.setVisible(boolean) is deprecated and inert. This avoids the deprecation warning on 9.8+ while preserving original behaviour on older Gradle versions.
|
Thanks! |
|
@martinbonnin @breskeby The If you're seeing any failures related to removing this call, I suspect those would be testing against pre-9.0 Gradle versions. If you're seeing a problem with removing this in any 9.x builds, please let us know. |
@ghale Indeed, from my testing yesterday, the flag is still needed up to
9.0.0+ is fine ✅ |
Hey @ghale , thanks for the clarification. |
Problem
The per-project nmcp plugin creates its producer configuration and calls
isVisible = falseon it. As of Gradle 9.8.0-milestone-2,Configuration.setVisible(boolean)is deprecated (scheduled for removal in Gradle 11):Any build that treats deprecation warnings as errors (
org.gradle.warning.mode=fail) fails as soon as a project applying the nmcp plugin is configured. This is present in every published version (0.1.5 … 1.6.1) and onmain, so consumers have no upgrade path around it. The elasticsearch team is affected by that.Surfaced downstream in Elasticsearch CI while bumping the Gradle wrapper to 9.8.0-milestone-2 — the build fails while configuring a subproject that applies the nmcp
elasticsearch.publishconvention plugin, becausegradle.propertiessetssystemProp.org.gradle.warning.mode=fail.Fix
Remove the
it.isVisible = falseline.visibleproperty because it "no longer has any meaningful effect on the build" (Gradle 9.8 upgrade guide,#deprecate-visible-property). Dropping the call changes no runtime behaviour on any supported Gradle version.nmcpProducerconfiguration out of certain reports — is now handled by thecanBeConsumed=true/canBeResolved=falserole flags, not byvisible.Only the producer configuration set
visible; the aggregation/consumer configuration is unaffected.Reproduce
with a project applying the nmcp per-project plugin under Gradle 9.8.0-milestone-2.