Maven, GWT and ECJ

When compiling a GWT webapp with the GWT Maven Plugin, you might encounter an exception such as

java.lang.NoSuchFieldError: warningThreshold

The reason is having ECJ in your classpath with a version different from what GWT includes. Unfortunately, GWT’s version is not repackaged and thus clashes with other versions. The quick fix is setting the gwtSdkFirstInClasspath configuration option for the gwt-maven-plugin (available since 2.1.0-1, see this issue):

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>gwt-maven-plugin</artifactId>
  <version>2.1.0-1</version>
  <configuration>
    ...
    <gwtSdkFirstInClasspath>true</gwtSdkFirstInClasspath>
  </configuration>
About these ads
This entry was posted in Eclipse, Java, Maven. Bookmark the permalink.

6 Responses to Maven, GWT and ECJ

  1. rulrura says:

    Wow~~~~~~ Thanks, Thanks…… very very much !!!!!

  2. S says:

    Worked like magic, thanks!

  3. Pingback: java.lang.NoSuchFieldError when compiling GWT project | RoboMemory

  4. Shrek says:

    You saved my life, man.

  5. Works like a charm! Thanks dude!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s