eclipse - 在 Eclipse 中运行 GWT-Maven 项目时遇到问题 - 无法在类路径中找到 'com/myco/clearing/product/ProductPlus.gwt.xml'

标签 eclipse gwt maven

我在 Win XP、Maven 3.0.3 和 GWT 2.4 上使用 Eclipse Indigo。我创建了一个 GWT-Maven 项目并按照此处的说明将其导入 Eclipse -- http://mojo.codehaus.org/gwt-maven-plugin/user-guide/archetype.html 。添加额外的源文件夹(target/generated-sources/gwt,说明中未提及的步骤)后,我右键单击我的项目,选择“运行方式”->“Web 应用程序”并收到此错误.. .

Loading modules
   com.myco.clearing.product.ProductPlus
       [ERROR] Unable to find 'com/myco/clearing/product/ProductPlus.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method

您对如何配置 Eclipse 来解决这个问题有什么想法吗?除了我提到的步骤之外,我没有做任何其他事情。

.gwt.xml 文件由原型(prototype)创建,位于 src/main/resources/war 目录中。其内容为

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='ProductPlus'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User' />

  <!-- We need the JUnit module in the main module,               -->
  <!-- otherwise eclipse complains (Google plugin bug?)           -->
  <inherits name='com.google.gwt.junit.JUnit' />

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.standard.Standard' />
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
  <entry-point class='war.client.ProductPlus' />

  <!-- Specify the paths for translatable code                    -->
  <source path='client' /> 
  <source path='shared' />

</module>

谢谢,-戴夫

最佳答案

尝试使用 m2Eclipse 运行您的应用程序...因为您的应用程序是 Maven 化的,所以您在尝试使用 GWT Eclipse 插件运行它时可能会遇到麻烦。 我所做的是:

  • 右键单击您的项目文件夹
  • 选择“运行方式 > Maven 构建...
  • 这将允许您创建新的运行配置。如果你只想 运行应用程序,只需将 gwt:run 添加到您的目标即可。如果你想 build 然后运行,将clean install gwt:run之类的内容添加到您的目标中。

也许这也会有帮助: - 确保在项目 > 属性 > Google > Web Toolkit 中,选中“使用 Google Web Toolkit”复选框(这会自动将生成的文件夹添加到您的类路径中)。 - 检查 Eclipse 是否知道这是一个 Maven 项目。如果是,您应该有一个名为“Maven Dependencies”的文件夹。如果不是,请右键单击您的项目,选择配置 > 转换为 Maven 项目

关于eclipse - 在 Eclipse 中运行 GWT-Maven 项目时遇到问题 - 无法在类路径中找到 'com/myco/clearing/product/ProductPlus.gwt.xml',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7971851/

相关文章:

java - 如何在 GWT 中包装来自 EasleJS 库的 MouseEvent 构造函数?

java - Gilead 替代品将 GWT 和 Hibernate 粘合在一起

javascript - GWT 的 JSONParser 生成错误的数字值

java - 使用 Maven 构建 Spark : error finding javac (but path is correct)

eclipse - 使用 netbeans 和 eclipse 编辑 netbeans 项目

java - 在 Main Activity 中的任何地方启动一个 Activity

java - Eclipse 中的 WSDL 验证命名空间失败

java - 为什么 jaxws-maven-plugin 忽略我的 .WSDL 文件?

maven - 是否可以根据 Sonarqube 中的项目重新排列小部件?

java - 将 Maven 存储库复制到另一台计算机