How to use the <source> tag in module XML file?

517 views
Skip to first unread message

stsch

unread,
Mar 29, 2009, 8:15:56 AM3/29/09
to Google Web Toolkit
In Eclipse I have let's say 2 projects:

-GwtApp: a fully functional GWT application including RPC services
etc.
-SomeOtherStuff: a separate Java project containing some other Java
classes

How do I tell the GWT compiler to include the Java classes in project
SomeOtherStuff in the compilation process?

There is the <source> tag but I have no idea how to apply it properly.
Could somebody please assist?

Thanks and kind regards,
-Steffen-

Ian Bambury

unread,
Mar 29, 2009, 8:26:52 AM3/29/09
to Google-We...@googlegroups.com
You need the 'inhetits' tag, e.g.

    <inherits name='com.domain.subproject.SubProject'/>

where the name is the *.gwt.xml file name.

Everything in the subproject must ne emulated by GWT

Ian

http://examples.roughian.com


2009/3/29 stsch <sts...@schliwinski.de>

sts...@schliwinski.de

unread,
Mar 29, 2009, 11:12:40 AM3/29/09
to Google Web Toolkit
Hi Ian,

thanks for your reply. Does that mean that I have to make my
subproject SomeOtherStuff a GWT module? How does the GWT Compiler know
where to "find" the referenced subproject with its *.gwt.xml file?

-Steffen-

On 29 Mrz., 14:26, Ian Bambury <ianbamb...@gmail.com> wrote:
> You need the 'inhetits' tag, e.g.
>     <inherits name='com.domain.subproject.SubProject'/>
>
> where the name is the *.gwt.xml file name.
>
> Everything in the subproject must ne emulated by GWT
>
> Ian
>
> http://examples.roughian.com
>
> 2009/3/29 stsch <stsc...@schliwinski.de>

Ian Bambury

unread,
Mar 29, 2009, 12:26:02 PM3/29/09
to Google-We...@googlegroups.com
Hi Stefan,

You need to add either the project or a jar (complete with directory structure and source) to the using project. If you need to know where/how, just say

sts...@schliwinski.de

unread,
Mar 29, 2009, 12:35:20 PM3/29/09
to Google Web Toolkit
Hi Ian,

yes, it would be nice to get this explained in a bit more detail.
Let's assume my class in the GWT project acting as the GWT Entry Point
is

de.stsch.j2ee.gwt.GwtClient.java

and in the subproject I have a Java class acting as a database entity

de.stsch.j2ee.db.Employee,

what would I have to do so that my main GWT project knows about the
referenced class in the subproject?

Thanks for your assistance,
-Steffen-



On 29 Mrz., 18:26, Ian Bambury <ianbamb...@gmail.com> wrote:
> Hi Stefan,
> You need to add either the project or a jar (complete with directory
> structure and source) to the using project. If you need to know where/how,
> just say
>
> Ian
>
> http://examples.roughian.com
>
> 2009/3/29 <stsc...@schliwinski.de>

Ian Bambury

unread,
Mar 29, 2009, 1:30:00 PM3/29/09
to Google-We...@googlegroups.com
I'm assuming you are using Eclipse and that db.Employee is something you use on the client side somehow.

You need a module file, say:

de.stsch.j2ee.db.DB.gwt.xml

In the main project's properties, in Java Build Path, under Projects, include the sub-project.

In the main project's module file, you need to inherit the subproject, something like:

    <inherits name='cde.stsch.j2ee.db.DB'/>

And that, as far as I remember, is it.

If it doesn't work, let me know and I'll do it for real as opposed to from memory.

Cheers,

Ian

sts...@schliwinski.de

unread,
Mar 29, 2009, 1:46:34 PM3/29/09
to Google Web Toolkit
Unfortunately this didn't work. Yes, I am using Eclipse and
db.Employee is an entity that gets filled in the backend on the server
and that I want to introduce to the client. If I add the subproject to
the main project via Java Build Path then Eclipse knows about this
relationship but what if I run the GWT Compiler? It doesn't use the
Eclipse settings.

What do I need to have in de.stsch.j2ee.db.DB.gwt.xml? Just an empty
file or any contents?

-Steffen-

Ian Bambury

unread,
Mar 29, 2009, 2:00:21 PM3/29/09
to Google-We...@googlegroups.com
If you run the GWT compiler from Eclipse it will work - I never use the standalone cmd file, so I can't help there.

The de.stsch.j2ee.db.DB.gwt.xml needs to have entries so that the compiler knows what GWT classes you are using.

I have two of these files - one to test the subproject and one when I include it in other projects. The latter one looks like this for me

<module rename-to='RXFramework'>
    <inherits name='com.google.gwt.user.User'/>
    <inherits name='com.google.gwt.json.JSON'/>
</module>

The other one has the same plus an entry point.

sts...@schliwinski.de

unread,
Mar 29, 2009, 2:45:21 PM3/29/09
to Google Web Toolkit
I added the file Db.gwt.xml to the package de.stsch.j2ee.db of the
subproject and added a

<inherits name='de.stsch.j2ee.db.Db'/>

to the module XML file of my main application and I still get an
Compiler error:

de.stsch.j2ee.db.Employee can not be found in source packages. 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.

I am still wondering how Eclipse could resolve this dependency; do you
have any plugins installed? How can you run the GWT Compiler from
inside eclipse?

Why do even the simplest things have to be so complicated? I have a
separate project and would like to add the contained resources as a
client resource to GWT so that they get compiled into Javascript...

If it works for you, can you please explain (maybe step by step) what
you did and how your project structure looks like?

-Steffen-

On 29 Mrz., 20:00, Ian Bambury <ianbamb...@gmail.com> wrote:
> If you run the GWT compiler from Eclipse it will work - I never use the
> standalone cmd file, so I can't help there.
> The de.stsch.j2ee.db.DB.gwt.xml needs to have entries so that the compiler
> knows what GWT classes you are using.
>
> I have two of these files - one to test the subproject and one when I
> include it in other projects. The latter one looks like this for me
>
> <module rename-to='RXFramework'>
>     <inherits name='com.google.gwt.user.User'/>
>     <inherits name='com.google.gwt.json.JSON'/>
> </module>
>
> The other one has the same plus an entry point.
>
> Ian
>
> http://examples.roughian.com
>
> 2009/3/29 <stsc...@schliwinski.de>

Ian Bambury

unread,
Mar 29, 2009, 4:22:38 PM3/29/09
to Google-We...@googlegroups.com
Hi Steffan,

I just did this from scratch and it works for me.

===============================

Highlighted the using project (let's call it Master)

Alt+Enter to get up Properties

Java Build Path on the left

Projects on the tab

Add

Select the utility project (let's call it Slave)

Click OK

Click OK

Add the inherits to the gwt.xml file

In Eclipse...

Run | Run configurations...

Select Master (this depends on what you called your project launch file)

Select ClassPath

Highlight User Entries

Click Advanced

Select Add Folders

Click OK

Navigate to and highlight the source folder for Slave (probably 'src' under 'Slave')

Click OK

Click Run

=================================================

To compile once it has run, click compile/Browse


Let me know how you get on.

Ian

sts...@schliwinski.de

unread,
Mar 30, 2009, 2:03:23 AM3/30/09
to Google Web Toolkit
Hi Ian,

no success, that is what I did exactly before. Again: How do you run
and compile your GWT project? What kind of Run/Compile launch
configuration are you using?

In the last step of the instructins you mention "Click Run". What do
you wanna run? Normally you would start the GWT hosted mode, you could
you do that from Eclipse?

-Steffen-

Ian Bambury

unread,
Mar 30, 2009, 7:03:42 AM3/30/09
to Google-We...@googlegroups.com


Hi Ian,

no success, that is what I did exactly before. Again: How do you run
and compile your GWT project? What kind of Run/Compile launch
configuration are you using?

The standard launch file. 


In the last step of the instructins you mention "Click Run". What do
you wanna run?
 
The project. I thought that was what this was all about.
 
Normally you would start the GWT hosted mode, you could
you do that from Eclipse?

If you had followed the instructions, you would *be* in Eclipse and the 'Run' button would start hosted mode.. So presumably you didn't actually do that..


-Steffen-

sts...@schliwinski.de

unread,
Mar 31, 2009, 2:32:26 AM3/31/09
to Google Web Toolkit
> The standard launch file.

What is the standard launch file? I hava a Java project in Eclipse,
the standard launch file would be a launch configuration for the main
Java class containing the main()-method and there is no such Java
class for a GWT application. Again: Do you have any plugin installed?

Ian Bambury

unread,
Mar 31, 2009, 7:27:47 AM3/31/09
to Google-We...@googlegroups.com
The .launch file that is created when you create a new GWT project

Muddasser Alam

unread,
Apr 2, 2009, 7:47:12 AM4/2/09
to Google Web Toolkit
Hi Steffan,
This is how I did it.

I had some classes in a package say x.y.z in the "source" folder of
project XYZ. I created a "abc.gwt.xml" file in the "source" folder
i.e. OUTSIDE the package (one level higher). There is only one entry
in that "abc.gwt.xml" file

<module>
<source path="x.y.z"/> <!--Your package name-->
</module>

Now you need to inherit this file into your GWT main entry class's
gwt.xml file. Lets say that class is xx, then you need to enter this
line in xx.gwt.xml

<inherits name="abc"/>

Now your GWT Compiler should be able to find those classes. I use
eclipse so I needed to include the XYZ project into the build file of
my project. Ian has already mentioned how to do it.

Hope it helps,

Regards,
Muddasser
> > Navigate to and highlight thesourcefolder for Slave (probably 'src' under
Reply all
Reply to author
Forward
0 new messages