Build breaks when running tests since Gradle seems to use wrong slf4j-version


(markus_fried) #1

Hi,

I’m using the latest Gradle version downloaded from here, nothing fancy at all. Win7 64bit, jdk 1.6.0_30

To get familiar with it I did a small project, just one class and one test for it. The test uses JUnit 4 annotation @Test, the method is empty (I removed all code).

When I run gradle build I get the following error:

c:\WS\t>gradle build :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava Download http://repo1.maven.org/maven2/junit/junit/4.9/junit-4.9.pom > Building > :compileTestJava > Resolving dependencies ‘:testCompile’ > 1 KB/unknown size downloDownload http://repo1.maven.org/maven2/junit/junit/4.9/junit-4.9.jar :processTestResources UP-TO-DATE :testClasses :test java.lang.NoSuchMethodError: org.slf4j.MarkerFactory.getDetachedMarker(Ljava/lang/String;)Lorg/slf4j/Marker;

at org.gradle.api.logging.Logging.(Logging.java:34)

at org.gradle.logging.internal.DefaultLoggingConfigurer.(DefaultLoggingConfigurer.java:28)

at org.gradle.logging.LoggingServiceRegistry.createLoggingManagerFactory(LoggingServiceRegistry.java:105)

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.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:179)

at org.gradle.internal.service.DefaultServiceRegistry.access$300(DefaultServiceRegistry.java:47)

at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.create(DefaultServiceRegistry.java:340)

at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:244)

at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getService(DefaultServiceRegistry.java:279)

at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getFactory(DefaultServiceRegistry.java:303)

at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getFactory(DefaultServiceRegistry.java:287)

at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.getFactory(DefaultServiceRegistry.java:205)

at org.gradle.internal.service.DefaultServiceRegistry.getFactory(DefaultServiceRegistry.java:162)

at org.gradle.internal.service.DefaultServiceRegistry.newInstance(DefaultServiceRegistry.java:173)

at org.gradle.process.internal.child.ImplementationClassLoaderWorker.createLoggingManager(ImplementationClassLoaderWorker.java:84)

at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:52)

at org.gradle.process.internal.child.ImplementationClassLoaderWorker.execute(ImplementationClassLoaderWorker.java:36)

at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:44)

at org.gradle.process.internal.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:33)

at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:46)

at org.gradle.process.internal.launcher.BootstrapClassLoaderWorker.call(BootstrapClassLoaderWorker.java:32)

at org.gradle.process.internal.launcher.GradleWorkerMain.run(GradleWorkerMain.java:30)

at org.gradle.process.internal.launcher.GradleWorkerMain.main(GradleWorkerMain.java:35)

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:test’. > Gradle Worker 1 finished with (non-zero) exit value 1.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 4.336 secs

my build.gradle looks as:

apply plugin: ‘java’ apply plugin: ‘eclipse’

sourceCompatibility = 1.5 version = ‘0.1’

jar {

manifest {

attributes ‘Implementation-Title’: ‘SBS’, ‘Implementation-Version’: version

} }

// from where will we resolve our dependencies? repositories {

mavenCentral() }

// all Dependencies go here!! dependencies {

testCompile ‘junit:junit:4.9’ } // end Dependencies

test {

systemProperties ‘property’: ‘value’ }

uploadArchives {

repositories {

flatDir {

dirs ‘repos’

}

} }

I can’t figure out what the problem is, compiling the tests is ok, running is not - any ideas?

Best regards Markus.


(Peter Niederwieser) #2

Corrupt Gradle installation? Do you have anything in your JRE’s ‘lib/ext’ directory? What’s the output of ‘gradle -v’?

Please enclose code and output in HTML ‘code’ tags. Otherwise, they are hard to read.


(markus_fried) #3

Hi Peter,

gradle -v gives me

------------------------------------------------------------
Gradle 1.0-rc-2
------------------------------------------------------------
  Gradle build time: Dienstag, 24. April 2012 23:52 Uhr UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_30 (Sun Microsystems Inc. 20.5-b03)
OS: Windows 7 6.1 x86

Compiling works just fine - it’s just the test runs…

my PATH contains some spaces, would this be a problem?

Markus.


(Peter Niederwieser) #4

Compiling works just fine - it’s just the test runs…

Tests get executed in a separate JVM, and apparently something goes wrong there.

my PATH contains some spaces, would this be a problem?

I don’t see how it would be related.

My best guess is that you have an old SLF4J version in the ‘lib/ext’ directory of the JRE that’s used to start the test JVM. I’ve just improved our logging to make it easier to tell which JRE is used.


(markus_fried) #5

a quick check showed only the sf4j Gradle comes with and another set of jars in the Eclipse plugin dirs.

I will try a fresh install on a different machine…


(markus_fried) #6

ok, on my Win7-64bit at home all works fine - so it’s the $%§$% machine at work.

Thanks anyway for looking into my problem - will have to fix it on my own :frowning:

Best regards Markus.


(Joe) #7

I’m having a similar Problem…

Everything worked fine a couple of days ago but now gradle seems to be “broken”. I can’t even call gradle -v.

$ gradle -v
  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.NoSuchMethodError: org.slf4j.MarkerFactory.getDetachedMarker(Ljava/lan
g/String;)Lorg/slf4j/Marker;
        at org.gradle.api.logging.Logging.<clinit>(Logging.java:34)
        at org.gradle.logging.internal.TerminalDetectorFactory.<clinit>(Terminal
DetectorFactory.java:33)
        at org.gradle.logging.LoggingServiceRegistry.createOutputEventRenderer(L
oggingServiceRegistry.java:127)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServ
iceRegistry.java:179)
        at org.gradle.internal.service.DefaultServiceRegistry.access$300(Default
ServiceRegistry.java:47)
        at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodServi
ce.create(DefaultServiceRegistry.java:340)
        at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvi
der.getInstance(DefaultServiceRegistry.java:244)
        at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.g
etService(DefaultServiceRegistry.java:279)
        at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.getSer
vice(DefaultServiceRegistry.java:219)
        at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultService
Registry.java:145)
        at org.gradle.logging.LoggingServiceRegistry.<init>(LoggingServiceRegist
ry.java:46)
        at org.gradle.logging.LoggingServiceRegistry.newCommandLineProcessLoggin
g(LoggingServiceRegistry.java:53)
        at org.gradle.launcher.cli.CommandLineActionFactory.createLoggingService
s(CommandLineActionFactory.java:74)
        at org.gradle.launcher.cli.CommandLineActionFactory.convert(CommandLineA
ctionFactory.java:54)
        at org.gradle.launcher.Main.doAction(Main.java:48)
        at org.gradle.launcher.exec.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(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:
50)
        at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:32)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:24)

I have the same setup like Markus - Win7 64bit, jdk 1.6.0_30 I also tried using the latest gradle-version (1.3) but i get the same error.

Any ideas?

Best regards Johannes.