Reputation: 20591
I have a maven multi-module project. One of this modules (compiled as .jar
) contains only domain objects, which will be used at client and server sides (I add this .jar
as dependency to other my modules).
I know that GWT module, where will be used objects from shared .jar
, must also have source files for successful compilation. So I tried to add to my pom.xml
both:
<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 resulting .jar
don't contain GWT module source (i.e gwt.xml
). All sources of domain classes are added as well (at root directory of .jar
), but ModuleName.gwt.xml
not.
Where is problem? Thanks.
Upvotes: 4
Views: 6763
Reputation: 3149
This error have multiple explanations. Check list:
*.gwt.xml
file in dot notation without the file extension. E.g. com.example.ThirdParty
refers to com/example/ThirdParty.gwt.xml
module<inherits name="com.example.ThirdParty" />
to your *.gwt.xml
fileThirdParty.gwt.xml
should contain one or more source
elements pointing to translatable code. E.g. <source path='shared' />
.ThirdParty.jar
needs to include plaintext *.java
sources. E.g. com/example/shared/Widget.class
and com/example/shared/Widget.java
are both presentThirdParty.jar
is on your classpathNotes:
ThirdParty
gwt module does not have entry point it does not need to be compiled with gwt compilerThirdParty
module as long as its jar is on classpath and your *.gwt.xml
inherits ThirdParty.gwt.xml
; the same applies to the gwt maven pluginUpvotes: 0
Reputation: 4822
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.
Upvotes: 0
Reputation: 16080
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,
Upvotes: 2