Skip to content

fix: use configurations.names to avoid resolution in unit tests#1652

Merged
hazendaz merged 1 commit intomasterfrom
copilot/review-test-failures
Apr 13, 2026
Merged

fix: use configurations.names to avoid resolution in unit tests#1652
hazendaz merged 1 commit intomasterfrom
copilot/review-test-failures

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 13, 2026

In Gradle 8.14.x, configurations.findByName() on a lazily-registered configuration with defaultDependencies triggers dependency resolution. Unit tests using ProjectBuilder have no repositories, causing ModuleVersionNotFoundException.

Changes

  • SpotBugsBasePluginApplicationSpec: Replace findByName(name) shouldNotBe null with configurations.names.contains(name) shouldBe true for all three configuration existence checks (spotbugs, spotbugsPlugins, spotbugsSlf4j)
// Before — triggers resolution in Gradle 8.14.x
project.configurations.findByName(SpotBugsPlugin.CONFIG_NAME) shouldNotBe null

// After — checks registration only, no resolution
project.configurations.names.contains(SpotBugsPlugin.CONFIG_NAME) shouldBe true

configurations.names returns registered names without realizing or resolving any configuration.

@sonarqubecloud
Copy link
Copy Markdown

@hazendaz hazendaz merged commit 0ba7222 into master Apr 13, 2026
10 checks passed
@hazendaz hazendaz deleted the copilot/review-test-failures branch April 13, 2026 01:44
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.

2 participants