Tuesday, November 30, 2010

Re: Starting GWT dev mode within Eclipse causes Maven-managed resources to disappear

On 17 nov, 15:45, Chris <crehb...@gmail.com> wrote:
> On Nov 17, 6:03 am, Thomas Broyer <t.bro...@gmail.com> wrote:
> > Well, if your resources are to be shared with GWT apps only, then how
> > about making a GWT module and putting them in the "public" path, so
> > the GWT compiler copies them to the output folder?
> Because we have 5 GWT apps using the same web resources and the point
> was to avoid duplicating them 5 times in source control.

Hence my proposal: use a GWT module with a "public" folder containing
the shared resources, and <inherits/> in all of your GWT apps. When
compiling a GWT app, everything from the public source will copied to
the app output folder (the subfolder in the "war" folder).
It might not be what you wanted though.

> > Or maybe those resources shouldn't be put into that folder to begin
> > with (it has always been the case that the <module-name> folder is
> > "GWT controlled" and always cleared by the GWT compiler before it
> > actually generates anything; it might have not always been the case
> > for DevMode but I don't see an issue with DevMode doing the same thing
> > as the compiler).
> This isn't a GWT compiler issue.  Nothing in this folder is generated
> by the compiler - all that goes to a subdirectory of target/<module
> name>.  Plus, this didn't happen with previous versions of GPE.  It
> started after upgrading to 1.4.0.

I just faced that very same issue, and a coworker too!
Eclipse 3.6 SR1
GPE 1.4.0
Maven projects using m2eclipse 0.10.2 with m2eclipse WTP integration.
Launching DevMode in -noserver, with src/main/webapp as the "war"
folder, it clears the whole src/main/webapp folder with the exception
of the WEB-INF/ folder, and it creates a subfolder where it puts the
*.nocache.js, hosted.html and clear.cache.gif.
The exact project layout is:
- myapp-shared: declares our GWT-RPC interfaces, depends on:
- gwt-servlet(scope=provided) for the RemoteService interface
- myapp-client: client-only code, depends on:
- myapp-shared(scope=provided) for the GWT-RPC interfaces
- myapp-shared:sources(scope=provided) so it has access to the Java
- gwt-user(scope=provided)
This is a <packaging>war</packaging> project, the GWT app is
compiled through gwt-maven-plugin at the prepare-package stage (note
that because of the packaging and m2eclipse, it happens to be a WTP
project, but is not deployed by itself to any server; also, its src/
main/webapp is completely empty)
- myapp-server: server-only code, implements the GWT-RPC as
RemoteServiceServlet-s, depends on:
- myapp-shared, for the GWT-RPC interfaces
- gwt-servlet
- (several other maven modules)
This is a <packaging>jar</packaging> project
- myapp: this is the webapp, with <package>war</packaging>, depends
- myapp-client(type=war), will be used automatically as an overlay
by maven-war-plugin
- myapp-server
- guice-servlet
- (several other maven modules)
This is the WTP app that's being deployed (to a Jetty 7.x instance,
using the Jetty WTP plugin)

I'm launching the myapp-client project "as Web Application" and
selects myapp/src/main/webapp as the "war" folder (note, myapp, not
myapp-client; so that the *.nocache.js is created there, I refresh the
folder and WTP automatically publishes the files to the server)

Result: the src/main/webapp/myapp is correctly created with the
*.nocache.js file, but the rest of src/main/webapp is cleared out,
with the exception of src/main/webapp/WEB-INF.
it even messes up with SVN, as an "svn update" (outside Eclipse, I'm
not using subclipse) doesn't recover the missing files!

> > As a last resort, you can still use -noserver...
> As a last resort I can simply copy the resources back into the folder
> after GPE deletes them and before I load the app in my browser.  It
> just seems broken that GPE is deleting whatever it wants from the
> build output directory when starting Jetty.

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment