Copilot commented on code in PR #27:
URL:
https://github.com/apache/grails-gradle-publish/pull/27#discussion_r3147652782
##########
plugin/src/main/groovy/org/apache/grails/gradle/publish/GrailsPublishGradlePlugin.groovy:
##########
@@ -331,6 +331,22 @@ Note: if project properties are used, the properties must
be defined prior to ap
if (extraArtefact) {
publication.artifact(extraArtefact)
}
+
+ // Ensure Gradle module metadata includes resolved
versions for
+ // all dependencies. Without this, dependencies
declared without
+ // an explicit version (relying on a platform/BOM)
are published
+ // with no version in the .module file, causing
resolution
+ // failures for consumers since Gradle prefers
.module over .pom.
+ if
(!project.extensions.findByType(JavaPlatformExtension)) {
+ publication.versionMapping { strategy ->
+ strategy.usage('java-api') { variant ->
+
variant.fromResolutionOf('runtimeClasspath')
+ }
+ strategy.usage('java-runtime') { variant ->
+ variant.fromResolutionResult()
+ }
+ }
Review Comment:
This change alters the published Gradle module metadata behavior but there’s
currently no functional test asserting that a published *.module file contains
resolved dependency versions when the producer declares dependencies without
explicit versions (via platform/BOM). Adding a functional test project that
uses a platform() dependency plus a versionless module dependency, then
asserting the generated .module includes a concrete version, would prevent
regressions (especially across Gradle upgrades).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]