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

Gradle 8 support #16

Open
mjones-vsat opened this issue Apr 19, 2023 · 4 comments
Open

Gradle 8 support #16

mjones-vsat opened this issue Apr 19, 2023 · 4 comments

Comments

@mjones-vsat
Copy link

When running evaluateViolations on a Gradle 8 project with Checkstyle enabled, the following occurs:

Caused by: groovy.lang.GroovyRuntimeException: Cannot get the value of write-only property 'destination' for Report xml of type org.gradle.api.reporting.internal.TaskGeneratedSingleFileR
eport.
        at org.gradle.internal.metaobject.AbstractDynamicObject.getWriteOnlyProperty(AbstractDynamicObject.java:101)
        at org.gradle.internal.metaobject.BeanDynamicObject$MetaClassAdapter.getProperty(BeanDynamicObject.java:229)
        at org.gradle.internal.metaobject.BeanDynamicObject.tryGetProperty(BeanDynamicObject.java:176)
        at org.gradle.internal.metaobject.CompositeDynamicObject.tryGetProperty(CompositeDynamicObject.java:55)
        at org.gradle.internal.metaobject.AbstractDynamicObject.getProperty(AbstractDynamicObject.java:60)
        at org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport_Decorated.getProperty(Unknown Source)
        at com.gradleup.staticanalysis.internal.checkstyle.CheckstyleConfigurator$_createCollectViolations_closure3.doCall(CheckstyleConfigurator.groovy:68)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at org.gradle.util.internal.ClosureBackedAction.execute(ClosureBackedAction.java:73)
        at org.gradle.util.internal.ConfigureUtil.configureTarget(ConfigureUtil.java:155)
        at org.gradle.util.internal.ConfigureUtil.configureSelf(ConfigureUtil.java:131)
        at org.gradle.api.internal.AbstractTask.configure(AbstractTask.java:695)
        at org.gradle.api.DefaultTask.configure(DefaultTask.java:319)
        at org.gradle.api.DefaultTask.configure(DefaultTask.java:45)
        at org.gradle.util.internal.ConfigureUtil.configure(ConfigureUtil.java:104)
        at org.gradle.util.internal.ConfigureUtil$WrappedConfigureAction.execute(ConfigureUtil.java:167)
        at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        at org.gradle.api.internal.DefaultMutationGuard$1.execute(DefaultMutationGuard.java:45)
        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:123)
        at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction$1.run(DefaultCollectionCallbackActionDecorator.java:110)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
        at org.gradle.api.internal.DefaultCollectionCallbackActionDecorator$BuildOperationEmittingAction.execute(DefaultCollectionCallbackActionDecorator.java:107)
        at org.gradle.internal.ImmutableActionSet$SetWithManyActions.execute(ImmutableActionSet.java:329)
        at org.gradle.api.internal.DefaultDomainObjectCollection.doAdd(DefaultDomainObjectCollection.java:262)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection.doAdd(DefaultNamedDomainObjectCollection.java:113)
        at org.gradle.api.internal.DefaultDomainObjectCollection.add(DefaultDomainObjectCollection.java:256)
        at org.gradle.api.internal.DefaultNamedDomainObjectCollection$AbstractDomainObjectCreatingProvider.tryCreate(DefaultNamedDomainObjectCollection.java:944)
        ... 166 more
@gounthar
Copy link

Thanks for opening this issue.
I have the same problem.
I haven't found any information about this in the pmd documentation.

@sixtsense
Copy link

Same here

@mjones-vsat
Copy link
Author

We have found a workaround. Please enjoy.

// Compatibility with Gradle Static Analysis plugin.
org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport.metaClass.tap {
    it.getDestination = {
        return delegate.outputLocation.get().getAsFile()
    }
    it.setDestination = { File value ->
        delegate.destination = value
    }
}

@Gelassen
Copy link

Gelassen commented Mar 1, 2024

@vsmteam , thank you for sharing, but when did you intent to put it and do you need anything besides supplied gradle? I use gradle-8.2 and compiler tells me metaClass doesn't exist.

My issue is:

* What went wrong:
Could not determine the dependencies of task ':app:collectcheckstyleDebugAndroidTestVariantViolations'.
> Could not create task ':app:collectCheckstyleAndroidTestDebugViolations'.
   > Cannot get the value of write-only property 'destination' for Report xml of type org.gradle.api.reporting.internal.TaskGeneratedSingleFileReport.

on running ./gradlew check

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

No branches or pull requests

4 participants