Test exception with Gradle Build but no with maven build

(Lionel Zuber) #1

i try to learn Gradle.

To began, i want to transform a Maven Build in Gradle Build. I do this but i’have a problem when i run test.

java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V

at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:159)

at org.springframework.test.context.TestContextManager.retrieveTestExecutionListeners(TestContextManager.java:185) …

No problem with Maven Build.

My Gradle Build : http://snipt.org/ugjn1 Maven build : http://snipt.org/ugjo6

Have you idea ?

For me, i have only one difference : i need to had Junit in Gradle compile dependency.

Thx for you’r help.

(Szczepan Faber) #2

What’s the gradle version you use? Can you put full stack trace somewhere we can see it? Also, the problem shows up when you run ‘gradle test’, right?

Typically such problem can occur if one is mixing version of slf4j api and implementation, for example different version of api and different version of jcl-over-slf4j. However, your build is using a consistent version.

Gradle uses slf4j 1.6.4 but that should not be a problem. You can also try bumping the sl4j to 1.6.4 and let us know if this helps in any way.

Hope that helps :slight_smile:

(Lionel Zuber) #3

I use 1.0-milestone 9.

I have change slf4j version then i have another error => a problem with database initialization. I had spring-jdbc.

Now i have new error and no idea :s => Incompatible Class Change Error.

Complete log : http://snipt.org/ugjT8

(Szczepan Faber) #4

Things you can do to investigate the problem:

-gradle clean build (just in case) -google for answers related to this particular Spring context initialization error -try running your former maven build with this version of slf4j and see if it makes any difference

Hope that helps :slight_smile: