1
votes

I have a multi module setup with one of the submodule being GWT and all other submodules being non-GWT. This works perfectly in eclipse where I am able to fire up GWT graphs and non-GWT apps. However I get following error in my GWT based submodule, when I do "mvn clean install"

  failed to execute goal org.codehause.mojo:gwt-maven-plugin:2.5.1: gwt module   com.mycompany.projectid.basecommon.Basecommon not found in project sources or resources

I reviewed GWT. Maven. GWT Module <module_name> not found in project sources or resources for similar question, but didnt help (because I dont understand it as my pom has no resources)

Below is pom file for non-GWT code (basically this submodule has few DTOs which will be used by client side of GWT and all other non-GWT modules)

  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>com.harmonia</groupId>
    <artifactId>cbm</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>base-common</artifactId>
<name>BASE-COMMONS</name>
<description>BASE-COMMONS</description>
<packaging>jar</packaging>
 </project>

Basecommon gwt.xml file is listed below and it is at src/main/java/com/mycompany/projectid/basecommon/Basecommon.gwt.xml

  <module>
 <inherits name='com.google.gwt.user.User'/>
   <source path='dto' />

Based on GWT Module ... not found in project sources or resources, I added following lines to my gwt based submodule, but no luck

  <configuration>
        <module>com.harmonia.cbm.basecommon.Basecommon</module>
<inplace>true</inplace>
<force>true</force>
</configuration>

Finally, I opened up Basecommon.jar file (non-gwt submodule with all DTOs) and it doesnt have any gwt.xml file (all it has is .class files). Any hints appreciated (I am very new to GWT and few months old to maven)

1

1 Answers

3
votes

As you suspected, the issue is that your gwt.xml file is not present in the JAR. And as you might have read in the other question, that's because it's in src/main/java and not declared as a <resource>.

Solutions:

  • either declare resources (*.java and *.gwt.xml files, possibly others if you use ClientBundle or UiBinder) as <resources>

  • use gwt:resources or gwt:source-jar

  • or build a source-jar with the maven-source-plugin and add it as a dependency (along with the "normal" JAR) to your GWT project:

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>base-common</artifactId>
      <version>${project.version}</version>
      <type>java-source</type>
    </dependency>
    

(note: <classifier>sources</classifier> also works, in place of <type>java-source</type>, but using the <type> is more correct)

See also http://mojo.codehaus.org/gwt-maven-plugin/user-guide/library.html (which is quite obviously not complete)


BTW, do not use <inplace>true</inplace> unless you fully understand the implications. I've yet to find a real use for that property.