class `org.gradle.api.internal.project.DefaultProject_Decorated` cannot be cast to class `org.gradle.api.initialization.Settings`
sschuberth opened this issue · 1 comments
With both Gradle 7.6 and 8.0 RC 1 and plugin version 0.4.0, I cannot successfully apply the plugin as I'm getting:
* What went wrong:
An exception occurred applying plugin request [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '0.4.0']
> Failed to apply plugin 'org.gradle.toolchains.foojay-resolver-convention'.
> class org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to class org.gradle.api.initialization.Settings (org.gradle.api.internal.project.DefaultProject_Decorated and org.gradle.api.initialization.Settings are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @6093dd95)
Stacktrace
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'org.gradle.toolchains.foojay-resolver-convention'. at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:173) at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:146) at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$applyLegacyPlugin$2(DefaultPluginRequestApplicator.java:159) at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:199) ... 174 more Caused by: java.lang.ClassCastException: class org.gradle.api.internal.project.DefaultProject_Decorated cannot be cast to class org.gradle.api.initialization.Settings (org.gradle.api.internal.project.DefaultProject_Decorated and org.gradle.api.initialization.Settings are in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @6093dd95) at org.gradle.toolchains.foojay.FoojayToolchainsConventionPlugin.apply(FoojayToolchainsConventionPlugin.kt:8) at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43) at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51) at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:187) at org.gradle.api.internal.plugins.DefaultPluginManager.access$100(DefaultPluginManager.java:52) at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:282) 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.plugins.DefaultPluginManager.lambda$doApply$0(DefaultPluginManager.java:167) at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:44) at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:166) ... 177 more
Ah, this seems to happen when accidentally applying the plugin inside a build.gradle.kts
on project level rather than inside settings.gradle.kts
on build level.