gradle / gradle/github-dependency-graph-gradle-plugin

ClassCastException on Gradle 9: DependencyExtractorBuildService cannot cast to DependencyExtractor

Open
#207 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Groovy
Stars
95
Forks
18
Avg merge
21h 23m
Merged PRs (30d)
4

Description

Plugin 1.4.1 crashes on Gradle 9.1 with a classloader conflict:

```
java.lang.ClassCastException: class org.gradle.dependencygraph.extractor.DependencyExtractorBuildService$Inject_
cannot be cast to class org.gradle.dependencygraph.extractor.DependencyExtractor
(... in unnamed module of loader VisitableURLClassLoader @4d89edf3;
... in unnamed module of loader VisitableURLClassLoader @a7df2df)
```

Two different classloader instances load the service class vs the interface it's cast to. Likely caused by Gradle 9's classloader isolation changes.

Happens via both `gradle/actions/setup-gradle@v5` (`dependency-graph: generate-and-submit`) and `gradle/actions/dependency-submission@v5` with `dependency-graph-plugin-version: '1.4.1'`.

**Versions:** Gradle 9.1, plugin 1.4.1, gradle/actions v5.0.2, JDK 17

v1.4.1 release notes mention "Test plugin with Gradle 9.x" but it doesn't work in practice.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.