问题
I get this exception when I run my tests from command line with maven. My command:
mvn -Dtest=specs.full.* -Dtestsystem=Win7/IE test
On my local machine, everything works fine. But when I run the tests on our server, where jenkins is installed, I get following exception:
java.lang.VerifyError: (class: specs/full/ReadCheckMenuLinks, method: super$8$$spock_feature_3_1 signature: ()V) Illegal use of nonvirtual function call
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:57)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:64)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:59)
at org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:54)
at org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52)
at org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:97)
at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:222)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:107)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
The strange thing is, that the tests worked on the server, but now I get this exception on every test I run.
What could be the problem here?
回答1:
It will most probably be down to the jvm version you're using on your CI server. I've seen similar errors when using Groovy with particular builds of Java 8. Have a look at what your local version of jvm is and ensure that the one used by Jenkins is the same.
来源:https://stackoverflow.com/questions/36227008/geb-exception-when-running-tests-in-maven