Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inherit external java source in GWT project

I have an ENUM that is used on the server-side. I want to be ably to use this enum on the client side (GWT) aswell.

This is the structure:

se.mycompany.core
se.mycompany.core.TheEnum <-- this Enum.

se.mycomapny.web.gwtproject <-- The GWT project.
se.mycomapny.web.gwtproject.client

I have tried to add

<inherits name="se.mycompany.core.TheEnum"/>

to my gwtproject.gwt.xml file. But I get the following error message:

[ERROR] Unable to find 'se/mycompany/core/TheEnum.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

I have tried to add the file TheEnum.gwt.xml to 'se/mycompany/core/' with the following context.

<module>
  <inherits name='com.google.gwt.user.User'/>
  <source path="TheEnum"></source>
</module> 

But it still complains about the same thing.

I'm guessing I need to add the se.mycompany.core.TheEnum to the classpath in build.xml somehow, but I dont know how or where.

like image 225
brange Avatar asked Oct 02 '12 10:10

brange


1 Answers

The "inherits" tag is used to import other modules, not individual classes. You could achieve what you want by creating a simple GWT module under the core package, and then inherit that module in the existing one:

Create a file called Core.gwt.xml under package se.mycompany.core with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<module>
    <source path="" includes="TheEnum.java"/>    
</module>

Then in your existing module add:

<inherits name='se.mycompany.core.Core'/>
like image 116
David Levesque Avatar answered Oct 15 '22 14:10

David Levesque