I have created a GWT Maven Multi Module project with the following structure.
Core Module [contains activities, presenters, shared resources] core.gwt.xml with entry point
core.gwt.xml
<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'/> -->
<!-- <stylesheet src="styles-global.css"/> -->
<!--GWT-QUERY -->
<!-- <inherits name='com.google.gwt.query.Query'/> -->
<!--SuperDev Mode -->
<!-- add-linker name="xsiframe"/> <set-configuration-property name="devModeRedirectEnabled"
value="true"/-->
<set-property name="user.agent" value="gecko1_8,safari" />
<!-- Other module inherits -->
<!-- We need the MVP stuff (Activity and Place -->
<!-- I am also using DepInj with Gin (Inject) -->
<!-- and Resource for client bundle and stuff (not used yet) -->
<inherits name="com.google.gwt.activity.Activity" />
<inherits name="com.google.gwt.place.Place" />
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.google.gwt.resources.Resources" />
<inherits name="com.google.gwt.user.Debug" />
<inherits name="org.fusesource.restygwt.RestyGWT"/>
<!-- gwtbootstrap3 -->
<inherits name="com.template.resources.CustomBootstrap"/>
<!-- Specify the app entry point class. -->
<entry-point class='com.template.core.client.template' />
<!-- Specify the paths for translatable code -->
<source path='client' />
<source path='shared' />
<!-- Form Factors -->
<inherits name="com.template.core.FormFactor" />
<!-- For JSON Ajax call -->
<inherits name="com.google.gwt.http.HTTP" />
<!-- For Logging Framework src: https://developers.google.com/web-toolkit/doc/latest/DevGuideLogging -->
<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.enabled" value="FALSE" />
<define-configuration-property name="gin.ginjector"
is-multi-valued="false" />
<set-configuration-property name='gin.ginjector'
value='com.template.core.client.ioc.ClientGinjector' />
<!-- gwt dnd -->
<inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
Desktop Module[contains desktop modules with desktop specific views] desktop.gwt.xml with entry point
desktop.gwt.xml
<?xml version="1.0" encoding="UTF-8"?>
<inherits name='com.template.core.template' />
<entry-point class='com.template.desktop.client.desktoptemplate' />
<source path='client' />
Tablet Module [contains tablet modules with tablet specific views] tablet.gwt.xml with entry point
Mobile Module [contains mobile modules with mobile specific views] mobile.gwt.xml with entry point
Desktop, Tablet and Mobile depend on the Core module. I have also inherited the core module in device modules and mentioned the dependency of core in device modules
I'm able to run these modules individually with google gwt plugin in eclipse perfectly. But when I'm performing a maven install on the root project the core module's entry point is not getting found and throwing below exception.
[ERROR] Unable to find type 'com.template.core.client.template' [INFO] [ERROR] Hint: Check that the type name 'com.template.core.client.template' is really what you meant [INFO] [ERROR] Hint: Check that your classpath includes all required source roots [INFO] [ERROR] Errors in 'file:/home/software/mmt/template_ui/template_ui_desktop/src/main/java/com/template/desktop/client/desktoptemplate.java' [INFO] [ERROR] Line 20: No source code is available for type com.template.core.client.ioc.ClientGinjector; did you forget to inherit a required module? [INFO] [ERROR] Line 21: No source code is available for type com.template.core.client.application.main.ServletURL; did you forget to inherit a required module? [INFO] [ERROR] Unable to find type 'com.template.desktop.client.desktoptemplate' [INFO] [ERROR] Hint: Previous compiler errors may have made this type unavailable [INFO] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[INFO] template User Interface .................................................................... SUCCESS [ 1.374 s] [INFO] Core Module ..................................................................................... SUCCESS [ 46.110 s] [INFO] Desktop Module..................................................................................FAILURE [ 23.713 s] [INFO] Tablet Module.................................................................... ..................................SKIPPED [INFO] Mobile Module .................................................................................................... SKIPPED
Solution
A gwt library should have both .java and .class files. So that we need to package both the files (also you can have .css, .png, .html e.t.c., files). You can include them by using below pom.xml configuration.
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.ui.xml</include>
<include>**/*.java</include>
<include>**/*.gwt.xml</include>
<include>**/*.html</include>
<include>**/*.js</include>
<include>**/*.css</include>
<include>**/*.gif</include>
<include>**/*.jpg</include>
<include>**/*.png</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
I have used this config in my core's pom.xml
A gwt library should have both .java and .class files. So that we need to package both the files (also you can have .css, .png, .html e.t.c., files). You can include them by using below pom.xml configuration.
I have used this config in my core's pom.xml