GWT. Maven GWT module <file_name> not found in project sources or resources

I have a multi-module maven project. One of these modules (compiled as .jar ) contains only domain objects that will be used on the client and server side (I add this .jar as a dependency on my other modules).

I know that the GWT module, where objects from a common .jar will be used, must also have source files for successful compilation. So I tried adding both to my pom.xml :

  <resources> <resource> <directory>src/main/java/<path></directory> <includes> <include>**/*.java</include> <include>**/*.gwt.xml</include> </includes> </resource> </resources> 

and

  <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <versionRange>[${gwt.version}]</versionRange> <goals> <goal>resources</goal> </goals> <plugin> 

But the .jar result does not contain the source of the GWT module (i.e. gwt.xml ). All domain class sources (in the .jar root directory) are also added, but ModuleName.gwt.xml not.

Where is the problem? Thanks.

+4
source share
3 answers

If your .gwt.xml file is located in src/main/resources/ , then it will not be copied if you specify src/main/java/ as the path to the resource ...

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

Greetings

+2
source

I searched for this error today, so I am just posting my fix:

The multi-module gwt project, built with the maven gwt plugin, needs to be written in pom.xml, for example:

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

To compile.

0
source

This error contains several explanations. Control List:

  • If you reference the gwt module, you need to point to the *.gwt.xml file in dotted notation without a file extension. For instance. com.example.ThirdParty refers to the module com/example/ThirdParty.gwt.xml
  • to import a third-party module, add <inherits name="com.example.ThirdParty" /> to your *.gwt.xml file
  • ThirdParty.gwt.xml must contain one or more source elements that point to the translated code. For instance. <source path='shared' /> .
  • All translatable codes in ThirdParty.jar must include the plaintext *.java sources. For instance. com/example/shared/Widget.class and com/example/shared/Widget.java both present
  • ThirdParty.jar is in your classpath

Notes:

  • if the ThirdParty gwt module ThirdParty not have an entry point, it does not need to be compiled using the gwt compiler
  • The gwt compiler does not require additional configuration to enable the ThirdParty module if its jar is in the classpath and your *.gwt.xml inherits ThirdParty.gwt.xml ; the same goes for the gwt maven plugin
0
source

Source: https://habr.com/ru/post/1446022/


All Articles