Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Gradle 8.11: ClassNotFoundException: org.gradle.api.reporting.internal.TaskReportContainer #76

Open
jhonnen opened this issue Nov 12, 2024 · 3 comments · May be fixed by #77

Comments

@jhonnen
Copy link

jhonnen commented Nov 12, 2024

The plugin is currently not compatible with Gradle 8.11 because the internal class TaskReportContainer was removed.

org.gradle.api.tasks.TaskInstantiationException: Could not create task of type 'Cpd'.	
    at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:95)	
    ...
Caused by: java.lang.NoClassDefFoundError: org/gradle/api/reporting/internal/TaskReportContainer	
    at de.aaschmid.gradle.plugins.cpd.Cpd.<init>(Cpd.java:97)	
    ...
Caused by: java.lang.ClassNotFoundException: org.gradle.api.reporting.internal.TaskReportContainer	
    at de.aaschmid.gradle.plugins.cpd.Cpd.<init>(Cpd.java:97)	
    at de.aaschmid.gradle.plugins.cpd.Cpd_Decorated.<init>(Unknown Source)
@aaschmid
Copy link
Owner

Thanks @jhonnen for reporting is. Do you already have a fix in mind and would like to contribute with a PR?

@jhonnen
Copy link
Author

jhonnen commented Nov 12, 2024

I don't have an obvious solution at the moment. The Gradle API doesn't seem to support report containers in 3rd party plugins.
In Gradle 8.11 they are implemented as follows:

public class JacocoReportsContainerImpl extends DelegatingReportContainer<ConfigurableReport> implements JacocoReportsContainer {

    @Inject
    public JacocoReportsContainerImpl(Describable owner, ObjectFactory objectFactory) {
        super(DefaultReportContainer.create(objectFactory, ConfigurableReport.class, factory -> ImmutableList.of(
            // ...
        )));
    }
    // ...
}

Both DelegatingReportContainer and DefaultReportContainer are still internal. You could of course just use that new internal API if you're OK with dropping support for Gradle <8.11

@cyanotyp
Copy link

cyanotyp commented Nov 13, 2024

Some updates and useful resources, that might help

Seems they recommend to use the Reporting Interface to develop an own Reporter/Logger Class
-> which the code already does, my bad. not familiar with gradle plugin development!

larsgrefer added a commit to joinfaces/joinfaces that referenced this issue Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants