Skip to content

Remove deprecated Configuration.setVisible(boolean) call (Gradle 9.8) - #271

Merged
martinbonnin merged 2 commits into
GradleUp:mainfrom
breskeby:fix-setvisible-deprecation-gradle98
Aug 27, 2026
Merged

Remove deprecated Configuration.setVisible(boolean) call (Gradle 9.8)#271
martinbonnin merged 2 commits into
GradleUp:mainfrom
breskeby:fix-setvisible-deprecation-gradle98

Conversation

@breskeby

@breskeby breskeby commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Problem

The per-project nmcp plugin creates its producer configuration and calls isVisible = false on it. As of Gradle 9.8.0-milestone-2, Configuration.setVisible(boolean) is deprecated (scheduled for removal in Gradle 11):

The Configuration.setVisible(boolean) method has been deprecated. This is
scheduled to be removed in Gradle 11.
	at nmcp.internal.DefaultNmcpExtension...  <-- offending call

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 on main, 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.publish convention plugin, because gradle.properties sets systemProp.org.gradle.warning.mode=fail.

Fix

Remove the it.isVisible = false line.

  • Gradle deprecated the visible property 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.
  • The original reason for the line (referencing no configured signatory issue #2) — keeping the internal nmcpProducer configuration out of certain reports — is now handled by the canBeConsumed=true / canBeResolved=false role flags, not by visible.

Only the producer configuration set visible; the aggregation/consumer configuration is unaffected.

Reproduce

./gradlew <someProject>:help --warning-mode=all --stacktrace

with a project applying the nmcp per-project plugin under Gradle 9.8.0-milestone-2.

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.
@martinbonnin

martinbonnin commented Aug 26, 2026

Copy link
Copy Markdown
Member

Thanks for sending this!

The original reason for the line - keeping the internal nmcpProducer configuration out of certain reports

IIRC, without isVisible = true, the publications ended up being published as part of assemble, which was triggered in some builds, which then failed if GPG keys were not set. Reports were not an issue.

I'd feel much safer if we put this behind a big if (Gradle >= 9.8.0) switch (assuming Gradle 9.8 doesn't require this).

@breskeby

Copy link
Copy Markdown
Contributor Author

@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.
breskeby added a commit to breskeby/protobuf-gradle-plugin that referenced this pull request Aug 27, 2026
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.
@martinbonnin
martinbonnin merged commit 6a82d12 into GradleUp:main Aug 27, 2026
1 check passed
@martinbonnin

Copy link
Copy Markdown
Member

Thanks!

@ghale

ghale commented Aug 27, 2026

Copy link
Copy Markdown

@martinbonnin @breskeby The Configuration.setVisible() flag changed in Gradle 9.0 such that it no longer has any effect. Gradle 9.8.0 then deprecates it for eventual removal (in Gradle 11).

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.

@martinbonnin

Copy link
Copy Markdown
Member

I suspect those would be testing against pre-9.0 Gradle versions.

@ghale Indeed, from my testing yesterday, the flag is still needed up to 8.14.2 at least.

If you're seeing a problem with removing this in any 9.x builds, please let us know.

9.0.0+ is fine ✅

@breskeby

Copy link
Copy Markdown
Contributor Author

@martinbonnin @breskeby The Configuration.setVisible() flag changed in Gradle 9.0 such that it no longer has any effect. Gradle 9.8.0 then deprecates it for eventual removal (in Gradle 11).

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.

Hey @ghale , thanks for the clarification.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants