[GRADLE-1525] ClassCastException doing integration testing via DefaultGradleConnector Created: 11/May/11  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: None

Type: Bug
Reporter: Marco Hunsicker Assignee: Unassigned
Resolution: Won't Fix Votes: 0

Attachments: File gradle-bug-1525.zip    

 Description   

Using the GradleConnector to perform integration testing of a plugin yields classloading problems. The attached project provides a self-containing example.

To reproduce:

  • decompress the attached archive
  • switch into the new directory
  • assemble the plugin:

$ gradle assemble

  • test the plugin:

$ gradle test

Expected output:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/John Doo/Documents/gradle-bug/plugin/src/test/resources/test01/build.gradle' line: 10
  • What went wrong:
    A problem occurred evaluating root project 'test01'.
    Cause: java.lang.ExceptionInInitializerError (no error message)
    Cause: plugin.CustomLogger cannot be cast to plugin.CustomLogger
  • Try:
    Run with --info or --debug option to get more log output.
  • Exception is:
    org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'test01'.
    at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:51)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
    at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
    at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:38)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:487)
    at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:71)
    at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
    at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
    at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
    at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:35)
    at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:463)
    at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:458)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:141)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:112)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:80)
    at org.gradle.tooling.internal.provider.ExecuteBuildAction.run(ExecuteBuildAction.java:43)
    at org.gradle.tooling.internal.provider.ConfiguringBuildAction.run(ConfiguringBuildAction.java:56)
    at org.gradle.tooling.internal.provider.EmbeddedGradleLauncherActionExecuter.execute(EmbeddedGradleLauncherActionExecuter.java:45)
    at org.gradle.tooling.internal.provider.EmbeddedGradleLauncherActionExecuter.execute(EmbeddedGradleLauncherActionExecuter.java:31)
    at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:56)
    at org.gradle.tooling.internal.provider.LoggingBridgingGradleLauncherActionExecuter.execute(LoggingBridgingGradleLauncherActionExecuter.java:30)
    at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:78)
    at org.gradle.tooling.internal.provider.DefaultConnection.executeBuild(DefaultConnection.java:67)
    at org.gradle.tooling.internal.consumer.LazyConnection$2.run(LazyConnection.java:81)
    at org.gradle.tooling.internal.consumer.LazyConnection.withConnection(LazyConnection.java:98)
    at org.gradle.tooling.internal.consumer.LazyConnection.executeBuild(LazyConnection.java:79)
    at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$1.run(ProgressLoggingConnection.java:52)
    at org.gradle.tooling.internal.consumer.ProgressLoggingConnection$1.run(ProgressLoggingConnection.java:50)
    at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.run(ProgressLoggingConnection.java:74)
    at org.gradle.tooling.internal.consumer.ProgressLoggingConnection.executeBuild(ProgressLoggingConnection.java:50)
    at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$1.run(DefaultAsyncConnection.java:44)
    at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$1.run(DefaultAsyncConnection.java:42)
    at org.gradle.tooling.internal.consumer.DefaultAsyncConnection$3.run(DefaultAsyncConnection.java:71)
    at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:63)
    Caused by: java.lang.ExceptionInInitializerError
    at plugin.SimplePlugin.apply(SimplePlugin.java:13)
    at plugin.SimplePlugin.apply(SimplePlugin.java:9)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.providePlugin(DefaultProjectsPluginContainer.java:103)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.addPluginInternal(DefaultProjectsPluginContainer.java:67)
    at org.gradle.api.internal.plugins.DefaultProjectsPluginContainer.apply(DefaultProjectsPluginContainer.java:37)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
    at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
    at org.gradle.api.internal.project.AbstractProject.apply(AbstractProject.java:854)
    at build_6n7ftk30ce43hsov8vv8t1pkk7$_run_closure1.doCall(/home/John Doo/Documents/gradle-bug/plugin/src/test/resources/test01/build.gradle:10)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:61)
    at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:31)
    at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:874)
    at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:879)
    at org.gradle.api.internal.project.AbstractProject.subprojects(AbstractProject.java:862)
    at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
    at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
    at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)
    at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.groovy:68)
    at build_6n7ftk30ce43hsov8vv8t1pkk7.run(/home/John Doo/Documents/gradle-bug/plugin/src/test/resources/test01/build.gradle:8)
    at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:49)
    ... 34 more
    Caused by: java.lang.ClassCastException: plugin.CustomLogger cannot be cast to plugin.CustomLogger
    at plugin.Log.getLogger(Log.java:23)
    at plugin.Log.getLogger(Log.java:14)
    at plugin.Log.<clinit>(Log.java:10)
    ... 56 more


 Comments   
Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:57:43 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.