On 12 Oct 2016, at 10:29, Luca Morettoni <luca@morettoni.net> wrote:Hi all, currently my application is using a single module for the GWT code, but I'd like to split it in some submodules to better organize the code.
Everything is under maven and I organised the main project layout using Thomas Broyer gwt-maven-archetypes [1], so now I have a main maven project and its 3 submodules (client, shared and server): my goal is to have the client submodule that will use the new GWT-submodules, but which is the best approach?
[1]https://github.com/tbroyer/gwt-maven-archetypes
I think I found a reasonable solution to my problem adding a maven submodule, and in the main pom.xml I just added this:
<modules>
<module>App-client</module>
<module>App-module-user</module>
<module>App-shared</module>
<module>App-server</module>
</modules>
<module>App-client</module>
<module>App-module-user</module>
<module>App-shared</module>
<module>App-server</module>
</modules>
in the "App-client" pom.xml (this is the main GWT app) I just added:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId> App-module-user</artifactId>
<version>${project.version}</version>
<type>gwt-lib</type>
</dependency>
<groupId>${project.groupId}</groupId>
<artifactId> App-module-user</artifactId>
<version>${project.version}</version>
<type>gwt-lib</type>
</dependency>
and last this is the pom.xml file for the App-module-user:
<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>net.morettoni.test</groupId>
<artifactId>App</artifactId>
<version>master</version>
</parent>
<artifactId>App-module-user</artifactId>
<packaging>gwt-lib</packaging>
<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>App-shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId> App-shared</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<!-- tests dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>net.morettoni.test.App.User</moduleName>
</configuration>
</plugin>
</plugins>
</build>
</project>
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>net.morettoni.test</groupId>
<artifactId>App</artifactId>
<version>master</version>
</parent>
<artifactId>App-module-user</artifactId>
<packaging>gwt-lib</packaging>
<prerequisites>
<maven>${mavenVersion}</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>App-shared</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId> App-shared</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
</dependency>
<!-- tests dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<configuration>
<moduleName>net.morettoni.test.App.User</moduleName>
</configuration>
</plugin>
</plugins>
</build>
</project>
Hope this may help others!
A special Thanks to Thomas for the FANTASTIC plugin!!!
--
Luca Morettoni <luca(AT)morettoni.net> | http://www.morettoni.net
http://it.linkedin.com/in/morettoni/ | http://twitter.com/morettoni
Luca Morettoni <luca(AT)morettoni.net> | http://www.morettoni.net
http://it.linkedin.com/in/morettoni/ | http://twitter.com/morettoni
No comments:
Post a Comment