I am trying to transform a working single GWT-Project into several Maven-Modules. New structure should look like this:
Project
|- pom.xml
|- Project-Common(only Common-Classes)
|--- pom.xml
|--- Packaging: jar
|- Project-War(includes *gwt.xml)
|--- pom.xml
|--- Packaging: war
My files look like this(many dependencies, I think i removed the unnecessary to make my problem more clear) Project pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>project</artifactId>
<packaging>pom</packaging>
<name>Project - Modules</name>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>com.project</groupId>
<artifactId>project-parent-parent</artifactId>
<version>2.0.0</version>
<relativePath />
</parent>
<modules>
<module>/project-war</module>
<module>/project-common</module>
</modules>
Project-Common pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>project-common</artifactId>
<packaging>jar</packaging>
<name>Project - Common</name>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>com.project</groupId>
<artifactId>project-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath />
</parent>
<build>
<plugins>
<plugin>
<groupId>com.github.koraktor</groupId>
<artifactId>mavanagaiata</artifactId>
<executions>
<execution>
<id>load-git-branch</id>
<phase>validate</phase>
<goals>
<goal>commit</goal>
</goals>
<configuration>
<dirtyFlag>*</dirtyFlag>
<gitDir>../../.git</gitDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Project-War pom.xml:
<modelVersion>4.0.0</modelVersion>
<artifactId>project-war</artifactId>
<version>1.1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Project - WAR</name>
<parent>
<groupId>com.project</groupId>
<artifactId>parent-project</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.project</groupId>
<artifactId>project-common</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.7.0</version>
<inherited>true</inherited>
<configuration>
<runTarget>/test.html</runTarget>
<modules>
<module>com.project.modules.Test</module>
</modules>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<id>VerifyRequestFactoryInterfaces</id>
<executable>java</executable>
<arguments>
<argument>-cp</argument>
<classpath />
<argument>com.google.web.bindery.requestfactory.apt.ValidationTool</argument>
<argument>${project.build.outputDirectory}</argument>
<argument>com.project.factorys.TestRequestFactory</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.koraktor</groupId>
<artifactId>mavanagaiata</artifactId>
<executions>
<execution>
<id>load-git-branch</id>
<phase>validate</phase>
<goals>
<goal>commit</goal>
</goals>
<configuration>
<dirtyFlag>*</dirtyFlag>
<gitDir>../../.git</gitDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The old Project was in my Project-War and I added Project & Project-Common. In this setup the Project builds and I get the "new" Project-War.war . But when I move a ErrorCode.java from Project-War to Project-Common I get the following Error:
[INFO] Tracing compile failure path for type 'com.project.modules.TestViewImpl' [INFO] [ERROR] Errors in '.../project/project-war/src/main/java/com/project/modules/TestViewImpl.java' [INFO] [ERROR] Line 20: No source code is available for type com.project.errorcodes.ErrorCode; did you forget to inherit a required module? [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
Found a Solution:
Added a Module in Common-Project
<module>
<inherits name='com.google.gwt.activity.Activity' />
<inherits name='com.google.gwt.place.Place' />
<inherits name="com.google.gwt.user.User" />
<inherits name='com.google.web.bindery.requestfactory.RequestFactory' />
<inherits name="com.google.gwt.user.cellview.CellView" />
<inherits name='com.google.gwt.logging.Logging' />
<inherits name="com.google.gwt.inject.Inject" />
<inherits name="com.google.gwt.text.Text" />
<inherits name="com.google.gwt.i18n.I18N" />
<inherits name="com.google.gwt.debug.Debug" />
<source path="shared"/>
</module>
any my ErrorCode.java is under Path shared/** .
In Project-War Modules I added <inherits name="com.project.Common" />
and in pom.xml from Project-War:
<dependency>
<groupId>com.project</groupId>
<artifactId>project-common</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.project</groupId>
<artifactId>project-common</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
Seems to need dependency with classifier in scope provided.