Found interface org.objectweb.asm.MethodVisitor, but class was expected

Hi,

We have a java 1.6 project using spring and camel and are trying to use gradle 1.2 as our build tool. When running tests, via spock, we get the exception java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.MethodVisitor, but class was expected

I’ve tried removing my build/ and .gradle directories, but with no luck

Any suggestions as to how to proceed with this. The unit test we have at the moment is simple and is not exercising any of the apache camel code.

Here is a gist to the dependency tree, gradle version output and failed test sample

https://gist.github.com/4063402

Thanks

I should add that our tests are written in groovy. Also I’ve seen looking at the dependency tree generated by gradle dependencies, spring is brining in version 3.x of asm which from what I understand is not binary compatile with 4.x which is what gradle is now using.

Ok,

Managed to work around this issue by ensuring the following:

use ‘groovy localGroovy()’

and include appropriate depedency on spock

‘testCompile “org.spockframework:spock-core:0.6-groovy-1.8”’

From what I can see this ensures the correct spock libraries for 1.8.6 groovy

Hope this helps somone else Cheers

You were using Groovy 2.0, which requires a newer version of ASM than some of your other libs (like Spring). To avoid such problems, always use ‘groovy-all’.

thanks