M5 failing to fork groovyc

I’m trying to upgrade from M3 to M5. I seem to have a problem compiling my Spock tests/specs (this is the only Groovy in my project at the moment). When it gets to compileTestGroovy (in one case; compileIntegTestGroovy in another), it fails because it cannot fork groovyc.

:platform:dm-mve:compileTestGroovy > >FAILURE: Build failed with an exception. > >* What went wrong: >Execution failed for task ‘:platform:dm-mve:compileTestGroovy’. >Cause: Error running forked groovyc.

Any idea why this would work in M3 but not M5? I found this old thread which I think is the same problem: http://gradle.1045684.n5.nabble.com/Groovyc-fork-failing-on-Windows-td3357060.html. However, Peter’s suggestion of how to prevent the forking does not seem to work with current Gradle.

Anyone have any suggestions? Any idea when the underlying Gradle issues will be resolved? For 1.0?

However, Peter’s suggestion of how to prevent the forking does not seem to work with current Gradle.

Are you sure? I’m not aware of any changes in this area.

Any idea when the underlying Gradle issues will be resolved? For 1.0?

Probably post-1.0. There also seems to be a problem on the Groovy side: http://jira.codehaus.org/browse/GROOVY-5024

But this worked with M3 so it would seem there has been some sort of regression with M5. Right? Is this regression understood already, or just not a concern?

Are you sure? I’m not aware of any changes in this area. OK, I tried again. My previous problem was that I was adding it in my root build.gradle and it was being applied to all sub-projects. However, if a sub-project did not have any Groovy-based integration tests, it failed to compile the script. So, I moved it to just the offending sub-project, and it seems to work – I can now compile the test. But,…

I cannot run the test.

:platform:dm-mve:integTest Execution for Test process ‘Gradle Worker 1’ FAILED org.gradle.api.internal.tasks.testing.TestSuiteExecutionException: Could not execute test class ‘com.lexmark.pssd.app.mve.flash.FlashFileUploadServiceIntegrationTest’.

at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestC lass(SuiteTestClassProcessor.java:51)

at sun.reflect.GeneratedMethodAccessor122.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm pl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispat ch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispat ch.java:24)

at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextC lassLoaderDispatch.java:32)

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHa ndler.invoke(ProxyDispatchAdapter.java:75)

at $Proxy3.processTestClass(Unknown Source)

at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(T estWorker.java:86)

at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm pl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispat ch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispat ch.java:24)

at org.gradle.messaging.remote.internal.TypeCastDispatch.dispatch(TypeCastDis patch.java:30)

at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerP rotocol.java:53)

at org.gradle.messaging.remote.internal.WorkerProtocol.handleIncoming(WorkerP rotocol.java:31)

at org.gradle.messaging.remote.internal.ProtocolStack$ProtocolStage.handleInc oming(ProtocolStack.java:167)

at org.gradle.messaging.remote.internal.ProtocolStack$BottomStage.handleIncom ing(ProtocolStack.java:277)

at org.gradle.messaging.remote.internal.ProtocolStack$BottomConnection$1.run( ProtocolStack.java:299)

at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatc h(ProtocolStack.java:120)

at org.gradle.messaging.remote.internal.ProtocolStack$ExecuteRunnable.dispatc h(ProtocolStack.java:116)

at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch .java:132)

at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java: 33)

at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)

at org.gradle.messaging.concurrent.DefaultExecutorFactory$StoppableExecutorIm pl$1.run(DefaultExecutorFactory.java:64)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor. java:885)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java :907)

at java.lang.Thread.run(Thread.java:619) Caused by: org.gradle.messaging.remote.internal.PlaceholderException: org.spockframew ork.runtime.InvalidSpecException: Specification ‘com.lexmark.pssd.app.mve.flash.Flash FileUploadServiceIntegrationTest’ was not compiled properly (Spock AST transform was not run); try to do a clean build

at org.spockframework.runtime.SpecUtil.checkIsSpec(SpecUtil.java:53)

at org.spockframework.runtime.SpecInfoBuilder.buildSpec(SpecInfoBuilder.java: 75)

at org.spockframework.runtime.SpecInfoBuilder.doBuild(SpecInfoBuilder.java:56 )

at org.spockframework.runtime.SpecInfoBuilder.build(SpecInfoBuilder.java:42)

at org.spockframework.runtime.Sputnik.getSpec(Sputnik.java:72)

at org.spockframework.runtime.Sputnik.runExtensionsIfNecessary(Sputnik.java:8 0)

at org.spockframework.runtime.Sputnik.run(Sputnik.java:55)

at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute (JUnitTestClassExecuter.java:51)

at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.proces sTestClass(JUnitTestClassProcessor.java:63)

at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestC lass(SuiteTestClassProcessor.java:49)

… 29 more

I can’t follow your explanations. The InvalidSpecException indicates that Spock isn’t on the compile class path. Spock itself is also built with Gradle 1.0-milestone-5 and all tests pass fine.

  1. I’m saying with M3, my Spock tests were compiled and executed just fine. 2. I’m saying after upgrading to M5, I was unable to compile due to Gradle not being able to fork groovyc. 3. I’m saying I implemented your suggested work-around to prevent the forking, at which point the Spock tests successfully compile. 4. I’m saying attempting to execute the Spock tests now that they are compiled results in the following failure:

Execution for Test process ‘Gradle Worker 1’ FAILED

TestSuiteExecutionException: Could not execute test class ‘com.lexmark.pssd.app.mve.flash.FlashFileUploadServiceIntegrationTest’.

at processTestClass(SuiteTestClassProcessor.java:51)

Caused by: PlaceholderException: org.spockframework.runtime.InvalidSpecException: >Specification ‘com.lexmark.pssd.app.mve.flash.FlashFileUploadServiceIntegrationTest’ was >not compiled properly (Spock AST transform was not run); try to do a clean build

5 Spock does appear to be on the classpath 6 Is the Spock build preventing the fork? If not, that is an apple compared to this orange.

First we should verify that you are indeed running into the “too long compile class path” issue. Run with --debug and look for the log output of the grooyyc Ant task. It should print out the whole compile class path. If you have grep available, try:

gradle clean build --debug | grep -A 50 'org.codehaus.groovy.tools.FileSystemCompiler'