a basic gwt-maven-plugin question

1,772 views
Skip to first unread message

Y2i

unread,
Sep 15, 2011, 6:10:41 PM9/15/11
to google-we...@googlegroups.com
Using the Archetype article shows an example of generating a basic maven GWT project
After the generation I run
mvn gwt:run
and the application runs.

Then I run
mvn gwt:compile
and the compilation fails.

When I update gwt-maven-plugin to point to GWT 2.4 I get exactly the same compilation error.

Are the errors related to GWT compiler not understanding maven directory structure? How these errors can be fixed?  Thank you for your help!

[INFO] Compiling module org.example.gwt.MyGwt
[INFO]    Validating newly compiled units
[INFO]       [ERROR] Errors in 'file:/home/.../workspace/mygwt/src/main/java/org/example/gwt/client/MyGwt.java'
[INFO]          [ERROR] Line 35: GreetingServiceAsync cannot be resolved to a type
[INFO]          [ERROR] Line 35: No source code is available for type GreetingServiceAsync; did you forget to inherit a required module?
[INFO]          [ERROR] Line 35: The method create(Class<?>) from the type GWT refers to the missing type GreetingServiceAsync
[INFO]          [ERROR] Line 37: Messages cannot be resolved to a type
[INFO]          [ERROR] Line 37: No source code is available for type Messages; did you forget to inherit a required module?
[INFO]          [ERROR] Line 37: The method create(Class<?>) from the type GWT refers to the missing type Messages
[INFO]          [ERROR] Line 37: Messages cannot be resolved to a type
[INFO]          [ERROR] Line 43: Messages cannot be resolved to a type
[INFO]          [ERROR] Line 45: Messages cannot be resolved to a type
[INFO]          [ERROR] Line 123: GreetingServiceAsync cannot be resolved to a type
[INFO]    Finding entry point classes
[INFO]       [ERROR] Unable to find type 'org.example.gwt.client.MyGwt'
[INFO]          [ERROR] Hint: Previous compiler errors may have made this type unavailable
[INFO]          [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly

pom.xml

Y2i

unread,
Sep 15, 2011, 6:30:23 PM9/15/11
to google-we...@googlegroups.com
Update:  running mvn compile before mvn gwt:compile reduces the number of errors.

[INFO] --- gwt-maven-plugin:2.3.0-1:compile (default-cli) @ mygwt ---
[INFO] Compiling module org.example.gwt.MyGwt
[INFO]    Validating newly compiled units
[INFO]       [ERROR] Errors in 'file:/home/.../workspace/mygwt/src/main/java/org/example/gwt/client/MyGwt.java'
[INFO]          [ERROR] Line 35: No source code is available for type org.example.gwt.client.GreetingServiceAsync; did you forget to inherit a required module?
[INFO]          [ERROR] Line 37: No source code is available for type org.example.gwt.client.Messages; did you forget to inherit a required module?
[INFO]    Finding entry point classes
[INFO]       [ERROR] Unable to find type 'org.example.gwt.client.MyGwt'
[INFO]          [ERROR] Hint: Previous compiler errors may have made this type unavailable
[INFO]          [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[INFO] ------------------------------------------------------------------------

Y2i

unread,
Sep 15, 2011, 7:03:05 PM9/15/11
to google-we...@googlegroups.com
Update: 

The two files GreetingServiceAsync.java and Messages.java are generated by gwt-maven-plugin and are placed to target/generated-sources/gwt directory.  Does anyone know how I can tell gwt compiler to look into this directory?

Thanks for your help!

Warren Tang

unread,
Sep 16, 2011, 2:50:31 AM9/16/11
to google-we...@googlegroups.com
Right click on that folder and then select "Build Path > Use as Source Folder".

Y2i

unread,
Sep 16, 2011, 2:58:51 AM9/16/11
to google-we...@googlegroups.com
The problem with that is Maven->Update Project Configuration wipes out this manual setting. 
Is it possible to do configure this in POM?  Ideally, it would useful to control the project from the command line outside of Eclipse.

Warren Tang

unread,
Sep 16, 2011, 3:14:56 AM9/16/11
to google-we...@googlegroups.com
It doesn't happen to me (Eclipse 3.6). I'd suggest you check this wiki for eclipse setup:
http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven

Regards,

Alexandre Dupriez

unread,
Sep 16, 2011, 3:29:02 AM9/16/11
to Google Web Toolkit
Could you please send us the relevant part of your POM and GWT module
configuration file?

Warren Tang

unread,
Sep 16, 2011, 4:58:44 AM9/16/11
to google-we...@googlegroups.com

Maven - update project configuration does break things for me:

 

  1. Modules argument missing in .launch files.
  2. GWT support unchecked.

Seems like gwt-maven-plugin does not catch up and still works in old ways.

Regards,
Warren Tang

Y2i

unread,
Sep 16, 2011, 11:08:55 AM9/16/11
to google-we...@googlegroups.com
Alexandre, the POM is attached to the first post.  Attaching the GWT module.
The POM and module files are generated using these instructions.
Thank you!
MyGwt.gwt.xml

Y2i

unread,
Sep 16, 2011, 11:13:22 AM9/16/11
to google-we...@googlegroups.com
Thanks for the link Warren!

Y2i

unread,
Sep 16, 2011, 11:20:28 AM9/16/11
to google-we...@googlegroups.com
Warren, I think that the manually configured things should be broken after running Update Project Configuration.  If the project is driven by maven, it does not make sense to store Eclipse configuration in the source control system.  Eclipse support should be automatically generated from the POM when importing a maven project to eclipse.  And mvn eclipse:clean should wipe out all eclipse support.

Alexandre Dupriez

unread,
Sep 16, 2011, 11:53:42 AM9/16/11
to Google Web Toolkit
Sorry, I did not see the POM before.

There are two plugins registered in your POM : gwt-maven-plugin and
maven-war-plugin. Why do you need both of them? The problem might come
from that: if the plugin maven-war is executed before gwt-maven, the
asynchronous classes will not be executed yet when maven-war-plugin is
triggered.

Alexandre.

On 16 sep, 17:20, Y2i <yur...@gmail.com> wrote:
> Warren, I think that the manually configured things should be broken after
> running Update Project Configuration.  If the project is driven by maven, it
> does not make sense to store Eclipse configuration in the source control
> system.  Eclipse support should be automatically generated from the POM when
> importing a maven project to eclipse.  And *mvn eclipse:clean* should wipe
> out all eclipse support.

Warren Tang

unread,
Sep 16, 2011, 12:06:10 PM9/16/11
to google-we...@googlegroups.com
True. That's what the "Update Project Configuration" command is meant to do. So the settings needs to be in pom.xml for it to survive the command. This can be done with the "build-helper-maven-plugin":

        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>add-source</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/apt</source>
                <source>${project.build.directory}/generated-sources/gwt</source>
              </sources>
            </configuration>
          </execution>

Regards,
Warren Tang

On 9/16/2011 11:20 PM, Y2i wrote:
Warren, I think that the manually configured things should be broken after running Update Project Configuration.  If the project is driven by maven, it does not make sense to store Eclipse configuration in the source control system.  Eclipse support should be automatically generated from the POM when importing a maven project to eclipse.  And mvn eclipse:clean should wipe out all eclipse support. --

Y2i

unread,
Sep 16, 2011, 12:10:11 PM9/16/11
to google-we...@googlegroups.com
Thanks for the response Alexandre.
The POM is auto-generated.  The war plugin is used for packaging since the project has <packaging>war</packaging>. 
The asynchronous classes are actually generated, but the compiler does not see them because they are placed in unusual directory.

Y2i

unread,
Sep 16, 2011, 1:15:55 PM9/16/11
to google-we...@googlegroups.com
Thanks Warren.

Rob

unread,
Sep 16, 2011, 9:23:51 PM9/16/11
to Google Web Toolkit

Y2i

unread,
Sep 17, 2011, 2:50:08 AM9/17/11
to google-we...@googlegroups.com
Rob, thanks for the links!
Reply all
Reply to author
Forward
0 new messages