ltamaster opened a new issue, #15539:
URL: https://github.com/apache/grails-core/issues/15539
### Expected Behavior
When upgrading to Grails 7.0.9, the build should succeed when using the
standard Groovy 4.x group redirection strategy. The grails-gradle-bom:7.0.9
artifact should reference the correct Apache Groovy 4.x BOM:
```
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-bom</artifactId>
<version>4.0.30</version>
<type>pom</type>
<scope>import</scope>
</dependency>
```
### Actual Behaviour
Build fails with dependency resolution error. The published POM for
grails-gradle-bom:7.0.9 incorrectly references the legacy Groovy 3.x BOM:
Maven Central POM:
https://repo1.maven.org/maven2/org/apache/grails/grails-gradle-bom/7.0.9/grails-gradle-bom-7.0.9.pom
(lines 165-170)
```
<dependency>
<groupId>org.codehaus.groovy</groupId> <!-- ❌ Wrong: legacy group
(Groovy 3.x) -->
<artifactId>groovy-bom</artifactId>
<version>3.0.25</version> <!-- ❌ Wrong: incompatible with
Grails 7 -->
<type>pom</type>
<scope>import</scope>
</dependency>
```
Why this breaks: When projects use standard Groovy group redirection
(org.codehaus.groovy → org.apache.groovy), Gradle tries to resolve
org.apache.groovy:groovy-bom:3.0.25 which doesn't exist (Apache Groovy starts
at 4.x), causing variant mismatch errors.
Full error message:
```
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':rundeckapp:assetCompile'.
> Could not resolve all files for configuration
':rundeckapp:runtimeClasspath'.
> Could not resolve org.codehaus.groovy:groovy-bom:3.0.25.
Required by:
project :rundeckapp > org.apache.grails:grails-bom:7.0.9 >
org.apache.grails.gradle:grails-gradle-model:7.0.9 >
org.apache.grails:grails-gradle-bom:7.0.9
> No matching variant of org.apache.groovy:groovy-bom:4.0.30 was
found. The consumer was configured to find a library for use during runtime,
compatible with Java 17, packaged as a jar, preferably optimized for standard
JVMs, and its dependencies declared externally but:
- Variant 'apiElements':
- Incompatible because this component declares a platform for
use during compile-time and the consumer needed a library for use during runtime
- Variant 'enforcedApiElements':
- Incompatible because this component declares an enforced
platform for use during compile-time and the consumer needed a library for use
during runtime
- Variant 'enforcedRuntimeElements' declares a component for use
during runtime:
- Incompatible because this component declares an enforced
platform and the consumer needed a library
- Variant 'runtimeElements' declares a component for use during
runtime:
- Incompatible because this component declares a platform and
the consumer needed a library
* Try:
> No matching variant errors are explained in more detail at
https://docs.gradle.org/8.14.4/userguide/variant_model.html#sub:variant-no-match.
```
### Steps To Reproduce
Create a new Grails 7.0.9 project:
```
grails create-app myapp --profile=web --version=7.0.9
cd myapp
```
In build.gradle, add the standard Groovy 4.x group redirection (recommended
for migrating from Groovy 3.x to 4.x):
```
allprojects {
configurations.all {
resolutionStrategy {
eachDependency { details ->
if (details.requested.group == 'org.codehaus.groovy') {
details.useTarget(
group: 'org.apache.groovy',
name: details.requested.name,
version: '4.0.30'
)
}
}
}
}
}
```
Ensure grails-bom is imported (usually already present in Grails apps):
```
dependencies {
implementation platform("org.apache.grails:grails-bom:$grailsVersion")
// ... other dependencies
}
```
Run the build:
```
./gradlew build
```
Result: Build fails with the error shown in "Actual Behaviour" above
### Environment Information
Operating System: macOS 14.x / Linux (reproducible on both)
JDK: OpenJDK 17.0.8 (OpenJDK Runtime Environment Zulu17.44+15-CA (build
17.0.8+7-LTS))
Gradle: 8.14.4
Groovy: 4.0.30 (expected)
### Example Application
https://github.com/rundeck/rundeck
### Version
7.0.9
--
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]