Keep version-less dependency declarations untouched in refreshVersionsMigrate - #741
Conversation
…sMigrate A version-less declaration means the version is provided by a platform (BoM) or dependency constraints. Appending the version placeholder to it breaks the build, since no versions.properties entry is added for such dependencies, and can silently corrupt string literals that look like coordinates (e.g. eachDependency matchers). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5b00bc7 to
1f468bb
Compare
CI failure analysis: pre-existing on
|
… current runners The stress test OOMs on run number 1 while compiling sample-groovy/buildSrc/build.gradle.kts, on unmodified main too, so 150M no longer fits the baseline footprint and the check fails for every PR. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
I've cherry-picked the CI fix from #742 onto this branch so CI can actually run for this PR — happy to drop that commit once #742 lands. Verification of the workflow fix on unmodified |
Fixes #740
Problem
refreshVersionsMigrateappends the version placeholder to version-less dependency declarations:A version-less declaration means the version is supplied by a platform/BoM (Spring Boot dependency management,
aws.sdk.kotlin:bom, …) or by dependency constraints. Migrating it to:_always breaks the build, because the migration only addsversions.propertiesentries for dependencies with hardcoded versions, so the new placeholder can never resolve:Because the rewrite is textual, it also corrupts string literals that merely look like coordinates, e.g.
resolutionStrategy.eachDependencymatchers ("co.elastic.clients:elasticsearch-java" -> useVersion(…)becomes"co.elastic.clients:elasticsearch-java:_" -> …, which never matches again).The cause is the empty alternative in
mavenCoordinateRegex((?:|:_|:$versionChars{3,})), which makes the fallback replacement match coordinates without a version.Fix
Introduce
mavenCoordinateWithVersionRegex(same regex, without the empty alternative) and use it for the:_fallback replacement only. Version-less coordinates are now left untouched by the fallback.The replacement of version-less coordinates with built-in dependency notations, when a mapping exists, is intentionally kept as-is (behavior covered by the existing
"Replace with dependency names, if present"test viaorg.apache.logging.log4j:log4j-jul).Testing
"Keep version-less maven coordinates untouched in build files"inMigrationTest./gradlew :refreshVersions:test --tests "de.fayard.refreshVersions.MigrationTest"passes🤖 Generated with Claude Code