views:

588

answers:

5

I have a utility module for GWT which doesn't have an UI (hence, there is no class which inherits from com.google.gwt.core.client.EntryPoint. When I try to compile this module with GWT 1.7.1, I get this error:

[ERROR] Module has no entry points defined

How do I get rid of this error? Do I really have to define a dummy entry point? How did Google ever compile their own utility modules???

+2  A: 

No you don't need an EntryPoint. Here is an example of one of my modules that doesn't have one:

<?xml version="1.0" encoding="UTF-8"?>
<module>
    <source path="grid" />
    <inherits name="com.google.gwt.user.User"/>
</module>

The short answer is you don't compile code in modules. GWT just needs them as source code. When you compile your main module (the one with the entry point) it uses the source from any other modules you have inherited in your .gwt.xml file to compile the entire project.

rustyshelf
+1 That didn't solve my issue but pointed me in the right direction.
Aaron Digulla
A: 

I'm using the gwt-maven-plugin Maven2 plugin to compile my code. I migrated the code from an old version of the maven-googlewebtoolkit2-plugin plugin. For the old plugin, I had to specify which modules were entry points like so:

    <compileTargets>
     <param>com.project.module.Module</param>
    </compileTargets>

For the new plugin, it's

    <module>com.project.module.Module</module>

Since the plugin couldn't find which modules to compile, it search for "*.gwt.xml" and compiled all of them into "UI modules" (which must have an entry point).

Aaron Digulla
+1  A: 

Utility Jars do not need to be compiled by GWT.

If you just want to reuse this as a library in other GWT applications then you just have to jar the .class and .java files in one jar and make sure that you have a .gwt.xml that says where the client source is. If you follow the conventions (client classes in client) then you can get away with just otherwise you need to specify a tag for the client package

Then make sure that you inherit this .gwt.xml in the projects where you want to compile an entry point.

David Nouls
+1 for the exact explanation.
Aaron Digulla
A: 

We've got a utilities module, which constructs & handles some common UI elements, and a bunch of javascript/json common tasks.

It looks like what we did (also migrated from the totsp plugin to the codehaus plugin somewhere along the line) was to include an entry point in the util module; it was just empty. (It includes the comment "Intentional no-op").

Then the pom just refers to the thing as a dependency.

LH
A: 

If using eclipse GWT plugin just remove the module without an EntryPoint from the moduleslist that pops up just before compiling.

NIclas Lindbegr