Gradle Plugin Spock Testing -


i'm writing plugin gradle 2.3 includes groovy 2.3.9, , attempting test using spock 1.0-groovy-2.3. i'm getting following error because spock trying use groovy 2.3.10.

the important bit.

groovy.lang.groovyruntimeexception: conflicting module versions. module [groovy-all loaded in version 2.3.9 , trying load version 2.3.10 

the "complete" stack trace.

failed instantiate spec 'plugintest' org.spockframework.util.internalspockerror: failed instantiate spec 'plugintest'     @ org.spockframework.runtime.basespecrunner.createspecinstance(basespecrunner.java:113)     @ org.spockframework.runtime.basespecrunner.run(basespecrunner.java:65)     @ org.spockframework.runtime.sputnik.run(sputnik.java:63)     @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.runtestclass(junittestclassexecuter.java:86)     @ org.gradle.api.internal.tasks.testing.junit.junittestclassexecuter.execute(junittestclassexecuter.java:49)     @ org.gradle.api.internal.tasks.testing.junit.junittestclassprocessor.processtestclass(junittestclassprocessor.java:64)     @ org.gradle.api.internal.tasks.testing.suitetestclassprocessor.processtestclass(suitetestclassprocessor.java:50)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:497)     @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:35)     @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:24)     @ org.gradle.messaging.dispatch.contextclassloaderdispatch.dispatch(contextclassloaderdispatch.java:32)     @ org.gradle.messaging.dispatch.proxydispatchadapter$dispatchinginvocationhandler.invoke(proxydispatchadapter.java:93)     @ com.sun.proxy.$proxy2.processtestclass(unknown source)     @ org.gradle.api.internal.tasks.testing.worker.testworker.processtestclass(testworker.java:106)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:497)     @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:35)     @ org.gradle.messaging.dispatch.reflectiondispatch.dispatch(reflectiondispatch.java:24)     @ org.gradle.messaging.remote.internal.hub.messagehub$handler.run(messagehub.java:360)     @ org.gradle.internal.concurrent.defaultexecutorfactory$stoppableexecutorimpl$1.run(defaultexecutorfactory.java:64)     @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142)     @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617)     @ java.lang.thread.run(thread.java:745) caused by: java.lang.exceptionininitializererror     @ org.codehaus.groovy.reflection.classinfo.isvalidweakmetaclass(classinfo.java:221)     @ org.codehaus.groovy.reflection.classinfo.getmetaclassforclass(classinfo.java:191)     @ org.codehaus.groovy.reflection.classinfo.getmetaclass(classinfo.java:236)     @ com.trxi.oracle.plugintest.$getstaticmetaclass(plugintest.groovy)     @ com.trxi.oracle.plugintest.<init>(plugintest.groovy)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:62)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)     @ java.lang.reflect.constructor.newinstance(constructor.java:422)     @ java.lang.class.newinstance(class.java:442)     @ org.spockframework.runtime.basespecrunner.createspecinstance(basespecrunner.java:107)     ... 27 more caused by: groovy.lang.groovyruntimeexception: conflicting module versions. module [groovy-all loaded in version 2.3.9 , trying load version 2.3.10     @ org.codehaus.groovy.runtime.metaclass.metaclassregistryimpl$defaultmodulelistener.onmodule(metaclassregistryimpl.java:509)     @ org.codehaus.groovy.runtime.m12n.extensionmodulescanner.scanextensionmodulefromproperties(extensionmodulescanner.java:77)     @ org.codehaus.groovy.runtime.m12n.extensionmodulescanner.scanextensionmodulefrommetainf(extensionmodulescanner.java:71)     @ org.codehaus.groovy.runtime.m12n.extensionmodulescanner.scanclasspathmodules(extensionmodulescanner.java:53)     @ org.codehaus.groovy.runtime.metaclass.metaclassregistryimpl.<init>(metaclassregistryimpl.java:110)     @ org.codehaus.groovy.runtime.metaclass.metaclassregistryimpl.<init>(metaclassregistryimpl.java:71)     @ groovy.lang.groovysystem.<clinit>(groovysystem.java:33)     ... 38 more 

the dependencies section of build.gradle file.

dependencies {     compile gradleapi()     compile localgroovy()     testcompile "org.spockframework:spock-core:1.0-groovy-2.3" } 

is there way configure gradleapi() use groovy 2.3.10 (or 2.4.3 spock 1.0-groovy-2.4) or configure spock 1.0-groovy-2.3 use groovy 2.3.9?

you can exclude transitive dependencies brought in spock solve version conflict. try:

dependencies {     compile gradleapi()     compile localgroovy()     testcompile ("org.spockframework:spock-core:1.0-groovy-2.3") {         exclude module: "groovy-all"     } } 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -