davidbairdala opened a new issue, #16335:
URL: https://github.com/apache/grails-core/issues/16335
### Expected Behavior
Applying core Gradle's `jacoco` plugin to a Grails app works as it does on
Grails 7.x (verified on 7.2.3): the `jacocoAgent` and `jacocoAnt`
configurations resolve `org.jacoco:org.jacoco.agent` /
`org.jacoco:org.jacoco.ant` via the jacoco plugin's `defaultDependencies { }`
hooks, and `./gradlew test` runs with coverage.
### Actual Behaviour
On Grails 8.0.0-M3 through M6 (re-verified at each milestone), `./gradlew
test` fails:
```
Execution failed for task ':test'.
> Expected configuration ':jacocoAgent' to contain exactly one file,
however, it contains no files.
```
`./gradlew dependencies --configuration jacocoAgent` shows the configuration
contains only the injected `org.apache.grails:grails-hibernate5-bom` platform.
Gradle's `defaultDependencies { }` only fires on an otherwise-empty
configuration (gradle/gradle#11209 documents that a platform-only configuration
does not count as empty), so the jacoco plugin's defaults never run and the
agent/ant jars are never added. The mechanism breaks any plugin that populates
a configuration via `defaultDependencies`, not just jacoco.
Likely origin: `GrailsGradlePlugin.applyGrailsBom()` (introduced with the
platform migration in #15467, applied in `afterEvaluate`) adds the BOM platform
to every configuration; #16009 already adjusted its ordering. Suggested fix:
scope the injection away from configurations owned by other plugins (or add the
platform via `withDependencies` only where version management is actually
needed).
Workaround we use:
```groovy
dependencies {
jacocoAgent "org.jacoco:org.jacoco.agent:${jacoco.toolVersion}"
jacocoAnt "org.jacoco:org.jacoco.ant:${jacoco.toolVersion}"
}
```
### Steps To Reproduce
1. Grails 8.0.0-M6 app (M3, M4, M5 also reproduce).
2. Add `id 'jacoco'` to the plugins block.
3. `./gradlew test`
4. Observe the `jacocoAgent` failure; `./gradlew dependencies
--configuration jacocoAgent` shows only the BOM platform.
### Environment Information
Linux, JDK 21 (Temurin 21.0.12), Gradle 8.14. Grails 8.0.0-M3..M6,
grails-hibernate5 BOM. Works on Grails 7.2.3
### Example Application
https://github.com/davidbairdala/grails8-bom-defaultdeps-repro
### Version
8.0.0-M6 (present since 8.0.0-M3)
--
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]