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

Dav*_*ave 5 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,指令中没有提到的步骤)之后,我右键单击了我的项目,选择了"Run As" - >"Web Application"并得到了这个错误.. .

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
Run Code Online (Sandbox Code Playgroud)

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

.gwt.xml文件由原型创建,位于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>
Run Code Online (Sandbox Code Playgroud)

谢谢, - 戴夫

Ren*_*ato 4

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

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

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