【发布时间】:2011-04-03 20:55:10
【问题描述】:
我刚开始使用 GWT。我使用 Eclipse 并安装了 GWT 插件。
我已按照此处Maven GWT 2.0 and Eclipse 的指示使用 gwt-maven-plugin 设置 GWT 项目。当我运行 Maven 目标 gwt:compile gwt:run 时,会启动 GWT 开发模式,我可以将其中的 url 复制到我的浏览器并查看标签。
但是项目有这个问题:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
如果我尝试将项目作为 Google Web 应用程序运行,我会收到以下警告:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
我可以通过将 web.xml 复制到 war 目录来解决这个问题,但是当作为 Google Web App 运行时,我仍然会遇到 URL 问题。
如果我在 Eclipse 中使用 Maven 和 GWT,我是否应该忽略 web.xml 问题并始终通过 Maven 目标在开发模式下运行应用程序?或者有没有办法进行设置,以便我可以作为 Google Web App 运行?
编辑:与上述相关,是否可以调试在 gwt:compile gwt:run 启动的开发模式下运行的 GWT 应用程序?我在我的应用程序中添加了断点,但它并没有停止它们。我不确定这是我配置错误还是不可能。
更新:
响应 Prem 的回答...
当我运行compile gwt:run 时,不会复制 web.xml 文件。当我运行install gwt:run 时,我得到了这个错误:
[INFO] --- gwt-maven-plugin:1.2:test (default) @ SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
我猜错误 http://jira.codehaus.org/browse/MGWT-24 包含在 gwt-maven-plugin 的 1.2 版中。通常我不会在构建 war 文件的项目上运行 install,但我希望至少能够通过构建周期的测试阶段。
有没有人知道为什么我会在安装时收到此错误,而不是在编译目标时收到此错误?另外,我是否应该期望将 web.xml 文件从 src/main/webapp/WEB-INF/web.xml 复制到 /war 目录?
【问题讨论】: