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] ------------------------------------------------------------------------
Do you need to use the snapshot of gwt-maven-plugin? It doesn’t seem to work for me using 1.2.
It didn’t work for me either with 1.2.
Worked for me when I’ve renamed my project to one without spaces:
“Project Maven Build” to “Project”.