NoClassDefFoundError com.google.gwt.dev.Compiler while building on Hudson

While compiling a maven webapp using GWT on Hudson, I’ve got the following issue :

[ERROR] Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gwt/dev/Compiler
[ERROR] Caused by: java.lang.ClassNotFoundException: com.google.gwt.dev.Compiler
[ERROR]  at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
[ERROR]  at java.security.AccessController.doPrivileged(Native Method)
[ERROR]  at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[ERROR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR]  at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
[ERROR]  at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

This can be solved by telling gwt-maven-plugin to use a localWorker. Here is the config for pom.xml :

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>1.3-SNAPSHOT</version>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
        <goal>generateAsync</goal>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
  <configuration>
    <runTarget>mypage.html</runTarget>
    <extraJvmArgs>-Xmx512m</extraJvmArgs>
    <generateDirectory>src/main/java</generateDirectory>
    <localWorkers>1</localWorkers>
  </configuration>
</plugin>

Then, you will happily see :

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------

3 thoughts on “NoClassDefFoundError com.google.gwt.dev.Compiler while building on Hudson

Leave a comment