GWT. Maven. GWT Module <module_name> not found in project sources or resources

…衆ロ難τιáo~ 提交于 2019-12-01 06:35:59

If your .gwt.xml file is in src/main/resources/ then it won't get copied if you specify src/main/java/ as the resource path...

You should probably omit the <resource> section and let the GWT plugin include the source in the jar or at least have two sections, one for the .gwt.xml file (src/main/resources or where you put it) and one for the source code (as you have it now).

Cheers,

I was troubleshooting this error today so I'm just posting my fix:

Multi-module gwt project being build with the maven gwt plugin needs an entry in the pom.xml like:

  <modules>
        <module>../theothermodule</module>
  </modules>

In order to compile.

This error have multiple explanations. Check list:

  • if you are referencing a gwt module you need to point to the *.gwt.xml file in dot notation without the file extension. E.g. com.example.ThirdParty refers to com/example/ThirdParty.gwt.xml module
  • to import the 3rd party module, add <inherits name="com.example.ThirdParty" /> to your *.gwt.xml file
  • the ThirdParty.gwt.xml should contain one or more source elements pointing to translatable code. E.g. <source path='shared' />.
  • all translatable code in ThirdParty.jar needs to include plaintext *.java sources. E.g. com/example/shared/Widget.class and com/example/shared/Widget.java are both present
  • the ThirdParty.jar is on your classpath

Notes:

  • if the ThirdParty gwt module does not have entry point it does not need to be compiled with gwt compiler
  • the gwt compiler does not require extra configuration to include the ThirdParty module as long as its jar is on classpath and your *.gwt.xml inherits ThirdParty.gwt.xml; the same applies to the gwt maven plugin
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!