开发者

Eclipse not building WEB-INF/classes for GWT

I've been using GWT together with Maven, but whatever I try to do, Eclipse does not want to compile the source code to the usual webapp/WEB-INF/classes folder automatically. I tried reproducing the problem using the gwtp-sample-basic sample from GWT-Platform; which can be found here: gwtp-samples-0.6.zip

Deploying and running the开发者_如何转开发 project via Jetty without the classes results in the following expected errors:

[WARN] Could not instantiate listener example.project.server.MyGuiceServletContextListener
java.lang.ClassNotFoundException: example.project.server.MyGuiceServletContextListener
...
[WARN] EXCEPTION 
java.lang.ClassNotFoundException: com.google.inject.servlet.GuiceFilter
...
[WARN] failed guiceFilter: javax.servlet.UnavailableException: com.google.inject.servlet.GuiceFilter
...
[WARN] Failed startup of context com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@aec7ab1{/,/home/user/Documents/Workspace/project/src/main/webapp}
javax.servlet.UnavailableException: com.google.inject.servlet.GuiceFilter
...

Using Ant, the classes get built to the correct folder webapp/WEB-INF/classes but it fails to do so with any Maven configuration I've tried to far.

  • Could this be something Maven specific?
  • Anything I might have forgotten to configure in Eclipse?
  • Anyone that had similar problems, plus found how to fix them?

Sidenotes: Using the default Sonatype Maven plugin for Eclipse. Also tried using the webAppCreator tool to reinitialize a Maven project but it didn't change the outcome. Using the default run configurations provided. The webapp/WEB-INF/lib automatically contains the required libraries.


Maven usually compiles into target/classes. When you build a WAR with Maven, Maven will copy the classes from there so they end up at the right place in the WAR.

So the question is: What do you mean by "running the project"? Usually, that means building a WAR and deploying it. If you do that, everything should work.

My guess is that you want to avoid this effort because it takes a pretty long time. But unless you tell us specifically how you have set up your project and how you "run" it (which container, which plug-ins do you use, things like that), it's impossible to help.

[EDIT] Your main problem is probably how the classpath is handed over to Jetty and whether it honors it or builds its own.

You may want to look at the GWT Maven Plugin which says "integrate nicelly into Eclipse, thanks to M2Eclipse and Google Eclipse plugins."

Also this blog post may help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜