GWT compile: Fork mode

Hello, can anyone explain us how to fork gwt compiling in gradle. However in Ant build it was a simple option to add:

<java classpathref="gwt-classpath" classname="" fork="true" failonerror="true">

Well my solution for gwt compiling look like this:

task gwtcompile( type:JavaExec){
  inputs.dir sourceSets.myproject.output.classesDir
  outputs.dir "$buildDir/war"
    args "-style"
  args "PRETTY"
  args "-localWorkers"
  args "5"
  //args "-war"
  //args "$buildDir/war"
  args "-logLevel"
  args "INFO"
  args "com.myproject.FrontEnd"
  args "-draftCompile"
      jvmArgs "-Xmx1024M"
  jvmArgs "-Xss1024k"
  jvmArgs "-Djava.awt.headless=true"
     maxHeapSize = '256M'

I don’t understand also why this causes an exception:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space...

Thank you

Check out Steffen Schäfer’s GWT Gradle: It’s much less painless that the GWT Maven plugin, especially for SuperDevMode.