Tuesday, November 30, 2010

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

On 30 nov, 16:42, Thomas Broyer <t.bro...@gmail.com> wrote:
> I just faced that very same issue, and a coworker too!

Forgot to precise: I'm on Win XP Pro SP3, my coworker is on Ubuntu
10.10; same configuration otherwise (Eclipse, m2eclipse, GPE)

> 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
> sources
>    - 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
> on
>    - 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!

It looks like this only happens if the server is started at the time I
launch the DevMode. If it's not, the src/main/webapp/myapp subfolder
is correctly created and nothing else is touched (i.e. my index.jsp,
myapp.css, etc. are still there in src/main/webapp).

I tried using myapp/target/myapp-0.0.1-SNAPSHOT as the "war" folder
for DevMode, but it doesn't work (m2eclipse WTP doesn't seem to
publish that folder directly, which is what I expected)

(some time passes)

...and now I try back with src/main/webapp as the "war" folder and it
works, with the server started !!! (tried using a full path, and then $
{resource_loc:myapp/src/main/webapp} in the launcher, both work,
without deleting anything).
And if I stop the server and launch the DevMode, I now have a
NullPointerException. I re-start the server, launch the DevMode:
exception still there!
Restarting Eclipse fixes it.

java.lang.RuntimeException:
com.google.gwt.dev.shell.remoteui.MessageTransport$RequestException:
java.lang.NullPointerException
at
com.google.gwt.dev.shell.remoteui.ViewerServiceClient.waitForResponseOrThrowUncheckedException(ViewerServiceClient.java:
351)
at
com.google.gwt.dev.shell.remoteui.ViewerServiceClient.initialize(ViewerServiceClient.java:
256)
at
com.google.gwt.dev.shell.remoteui.RemoteUI.moduleLoadComplete(RemoteUI.java:
133)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:798)
at com.google.gwt.dev.DevMode.main(DevMode.java:282)
Caused by: com.google.gwt.dev.shell.remoteui.MessageTransport
$RequestException: java.lang.NullPointerException
at
com.google.gwt.dev.shell.remoteui.MessageTransport.processFailure(MessageTransport.java:
376)
at
com.google.gwt.dev.shell.remoteui.MessageTransport.processMessage(MessageTransport.java:
401)
at com.google.gwt.dev.shell.remoteui.MessageTransport.access
$300(MessageTransport.java:44)
at com.google.gwt.dev.shell.remoteui.MessageTransport
$3.run(MessageTransport.java:314)
at java.lang.Thread.run(Thread.java:662)

I'm lost. I'm very new to Eclipse WTP (a couple of weeks) and not much
less to Maven (5 months), so maybe it's just me; but really, I don't
understand why it worked, then deleted everything, then now works
again...

--
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