Well, obviously it's not possible since GWT can't handle Java 5
source. So I'm doing the next best thing: I'm writing a very
lightweight DTO generator with the JAM tool (part of Codehaus's
AnnoGen). It basically creates a set of DTO classes that shadow my
domain classes, leaving all the JDK 5 syntax out. Some minor
extensions to avoid creating fields that aren't emulated by GWT, some
reflection glue to populate a DTO graph from an entity graph, and
there you have it.
Except now I need to use these DTO classes in my actual GWT module.
And since these are generated files, I don't want to inject them right
into the source tree of my GWT module (never commingle generated
source with hand-crafted source!).
So I'm trying to make another module, "dto.GeneratedDto", which JUST
contains the DTOs. This module really only wants to be a small set of
plain Javabeans, bundled into a module that I can share from
elsewhere. Then I want to inherit dto.GeneratedDto from my actual
modules.
Hence, I've got the following directory hierarchy for the
dto.GeneratedDto module:
build/
generated/
dto.GeneratedDto/ <-- the module directory
dto/
GeneratedDto.gwt.xml
domain/
Blog.java
BlogEntry.java
HitCount.java
And my GeneratedDto.gwt.xml file is simply:
<module>
<!-- Specify the source. This module ONLY has source. -->
<source path="domain"/>
</module>
But when I point the GWT compiler at this, I get this error:
[java] [ERROR] Module has no entry points defined
[java] [ERROR] Build failed
Well, yes, the module has no entry points defined. I don't WANT the
module to have any entry points defined. It's a simple library, not
referenced from HTML anywhere. This page:
says, quote:
"An entry point application class name; these are optional, although
any module referred to in HTML must have at least one entry-point
class specified."
So why is the GWT compiler complaining about my module not having an
entry point? And more generally, is there some better way to do what
I'm trying to do here?
Thanks very much for any enlightenment. And don't be rude,
Reinier :-)
Cheers!
Rob
dto.GeneratedDto / <-- the module directory
On Apr 24, 10:24 am, Rob Jellinghaus <rjellingh...@gmail.com> wrote:
> Thanks very much for any enlightenment. And don't be rude,
> Reinier :-)
> Cheers!
> Rob
You refer to this module from another using an <inherit> tag in
the .gwt.xml file of your real project. You then compile/hosted-mode-
run THAT one, and everything will work. In other words, you don't need
to compile this one. This works for any <inherit> shenanigans; you
only compile the one module with the entry point that includes all
others, and that one compilation job will compile everything to one
single .js file (well, actually, one .html containing js for each
permutation, but, details). Totally different from the ordinary .java
to .class compilation process, which takes a bit getting used to.
Make sure you <inherit> dto.GeneratedDto.GeneratedDto in your main
proejct's .gwt.xml file.
Hope that helps!
NB: Oh, and because you asked so nicely: You are obviously dumber than
a goldfish with aquaphobia for asking such a ridiculous question! ;-P
Yeah, it has been flaky, hasn't it?
> You refer to this module from another using an <inherit> tag in
> the .gwt.xml file of your real project. You then compile/hosted-mode-
> run THAT one, and everything will work. In other words, you don't need
> to compile this one.
AHA. Duh. Now THAT is helpful. I tried Fred's suggestion and it
didn't work, but this one sounds like a winner.
> Make sure you <inherit> dto.GeneratedDto.GeneratedDto in your main
> proejct's .gwt.xml file.
Not just dto.GeneratedDto? I'll try it both ways but I expect
dto.GeneratedDto to work.
Once I get this working I'll post the source -- this is turning into a
little mini framework for generating DTO hierarchies, stripping out
all problematic GWT imports, Java 5 constructs, etc. Seems like
there's a lot of need for it.
> NB: Oh, and because you asked so nicely: You are obviously dumber than
> a goldfish with aquaphobia for asking such a ridiculous question! ;-P
Ah phew, I thought you were someone posing as Reinier for a minute :-)
Cheers!
Rob
will perform the following task:
Take each path in the current CLASSPATH, and look from there for:
(CLASSPATH-ENTRY)/dto/GeneratedDto/GeneratedDto.gwt.xml
if found, assume the directory that contains the .gwt.xml file is the
'root' for any further (possibly implied) <source> and <public> tags
in that .gwt.xml file, and do not allow any paths in this .gwt.xml
file to '..' to a parent of the directory that contains the .gwt.xml
file.
I misread your directory structure. You will indeed need to use
"dto.GeneratedDto", not a double GeneratedDto, and you'll have to put
the "dto.GeneratedDto" directory in the classpath. If you're using
eclipse, this makes a lot of sense as a structure.
Carry on!