To join multiple gwt compiled modules into a single .war
file, it is very easy with the maven-dependency-plugin
- Package all your gwt examples as habitual (.war), and install them
mvn install
ormvn deploy
if you have a private maven repo. - Create an empty maven module of type
war
, with no code but with the maven folder structure, you can put any additional stuff you need here like a globalsrc/main/webapp/index.html
. Configure the new module to use the
maven-dependency-plugin
like shown below, and runmvn package
:<dependency> <groupId>my.group</groupId> <artifactId>example1</artifactId> <version>...</version> <type>war</type> </dependency> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack-gwt-examples</id> <phase>prepare-package</phase> <goals> <goal>unpack-dependencies</goal> </goals> <configuration> <includeGroupIds>my.group</includeGroupIds> <includes>**/example1/**</includes> <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory> </configuration> </execution> </executions> </plugin>
Finally and related with the gwt-maven-plugin, like with any other maven pluging, it would be enough to select an appropriate phase of the pom-packaging life cycle (package, install or deploy):
...
<packaging>pom</packaging>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
...
<configuration>
...
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
Unfortunately, gwt-maven-plugin specifically disallows compilation when packaging is pom, take a look to line #269 of CompileMojo.java