Gradle fails with internal error whenever it runs

env - FRESH Gradle 1.4 install (NO MODS OF ANY KIND), Mac OS X 10.8.2, JDK 1.6_41, Groovy 2.0.5

Fails on ANY command with -

FAILURE: Build aborted because of an internal error.

  • What went wrong: Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.

  • Try: Run with --debug option to get additional debug info.

  • Exception is: java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

at org.gradle.logging.internal.logback.LogbackLoggingConfigurer.doFailSafeConfiguration(LogbackLoggingConfigurer.java:86)

at org.gradle.logging.internal.logback.LogbackLoggingConfigurer.configure(LogbackLoggingConfigurer.java:61)

at org.gradle.logging.internal.DefaultLoggingConfigurer.configure(DefaultLoggingConfigurer.java:37)

at org.gradle.logging.internal.LoggingSystemAdapter.setLevel(LoggingSystemAdapter.java:55)

at org.gradle.logging.internal.LoggingSystemAdapter.on(LoggingSystemAdapter.java:42)

at org.gradle.logging.internal.DefaultLoggingManager$StartableLoggingSystem.start(DefaultLoggingManager.java:171)

at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:60)

at org.gradle.logging.internal.DefaultLoggingManager.start(DefaultLoggingManager.java:31)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:167)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:48)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:39)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:26)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)

It looks like slf4j-log4j.jar is ending up on the classpath used to launch Gradle, conflicting with logback-classic.jar. If you haven’t added anything to the Gradle distribution’s lib directory, then the jar might be coming from something in the environment. Some options:

  • Via the ‘$GRADLE_OPTS’ or ‘$JAVA_OPTS’ environment variables * In ‘$JAVA_HOME/lib/ext’ * Using a non-standard ‘java’ launcher in ‘$JAVA_HOME/bin’

You may get a hint if you run ‘gradle tasks --debug’ and check the output for lines like:

SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in...