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

afterEvaluate AbstractMutationGuard$IllegalMutationException #2268

Open
gaborbernat opened this issue Sep 23, 2024 · 0 comments
Open

afterEvaluate AbstractMutationGuard$IllegalMutationException #2268

gaborbernat opened this issue Sep 23, 2024 · 0 comments

Comments

@gaborbernat
Copy link

gaborbernat commented Sep 23, 2024

I am getting

Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type com.diffplug.gradle.spotless.SpotlessExtensionImpl.
        at         at org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator.doCreate(DependencyInjectingInstantiator.java:70)
        at org.gradle.internal.instantiation.generator.DependencyInjectingInstantiator.newInstanceWithDisplayName(DependencyInjectingInstantiator.java:51)
        at org.gradle.internal.extensibility.DefaultConvention.instantiate(DefaultConvention.java:229)
        at org.gradle.internal.extensibility.DefaultConvention.create(DefaultConvention.java:150)
        at org.gradle.internal.extensibility.DefaultConvention.create(DefaultConvention.java:145)
        at com.diffplug.gradle.spotless.SpotlessPlugin.apply(SpotlessPlugin.java:53)

due to:

Caused by: org.gradle.api.internal.AbstractMutationGuard$IllegalMutationException: Project#afterEvaluate(Action) on project ':x:x-core' cannot be executed in the current context.
        at org.gradle.api.internal.AbstractMutationGuard.createIllegalStateException(AbstractMutationGuard.java:39)
        at org.gradle.api.internal.AbstractMutationGuard.assertMutationAllowed(AbstractMutationGuard.java:34)
        at org.gradle.api.internal.project.DefaultProject.assertMutatingMethodAllowed(DefaultProject.java:1477)
        at org.gradle.api.internal.project.DefaultProject.afterEvaluate(DefaultProject.java:1054)
        at com.diffplug.gradle.spotless.SpotlessExtensionImpl.<init>(SpotlessExtensionImpl.java:42)

Following some chat in the Gradle Slack chat:

looks like a bug in the plugin implementation, so I'd raise a bug
afterEvalute {} should be avoided wherever possible, and I don't think it's needed here


you could try setting enforceCheck = false and setting up the task dependency in a more idiomatic way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants