GWT+ Maven and Eclipse compilation for more than one module

192 views Asked by At

I'm using the recommended GWT Maven Plugin and the GWT Eclipse Plugin. Actually I'm using the maven plugin with the appengine-mave-plugin to try to emulate the old Google Eclipse Plugin Super Dev Mode. Following the Google App Engine instructions from the GWT Plugin documentation and the suggested sample project gwt-basic-rpc-appengine I created this project structured that my project runs in super dev mode when I launch the App Engine local server from Eclipse (using the Eclipse Google Cloud Tools local App Engine server launcher tool). From Maven, this process works following: mvn clean package appengine:devserver_start and mvn gwt:codeserver.

However, the Maven GWT plugin only compiles one of the four modules. This is my pom.xml configuration:

<!-- GWT Maven Plugin-->
      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>1.0-rc-8</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
             <!--  <goal>test</goal>-->
            </goals>
          </execution>
        </executions>
        <configuration>
          <moduleName>com.company.Administracion</moduleName>
          <moduleName>com.company.Cronometro</moduleName>
          <moduleName>com.company.Extension</moduleName>
          <moduleName>com.company.Company</moduleName>
        <!--   <moduleShortName>Nubbius</moduleShortName> -->
          <failOnError>true</failOnError>
          <!-- GWT compiler 2.8 requires 1.8, hence define sourceLevel here if you use
               a different source language for java compilation -->
          <sourceLevel>1.8</sourceLevel>
          <!-- Compiler configuration -->
          <localWorkers>4</localWorkers>
          <draftCompile>true</draftCompile>
          <compilerArgs>
            <!-- Ask GWT to create the Story of Your Compile (SOYC) (gwt:compile) -->
            <arg>-compileReport</arg>
            <arg>-XcompilerMetrics</arg>
          </compilerArgs>
          <!-- DevMode configuration -->
          <!-- <warDir>${project.build.directory}/${project.build.finalName}</warDir>
-->
          <launcherDir>${project.build.directory}/${project.build.finalName}</launcherDir>
          <classpathScope>compile+runtime</classpathScope>
          <codeServerPort>auto</codeServerPort>
          <!-- URL(s) that should be opened by DevMode (gwt:devmode). -->
          <startupUrls>
            <startupUrl>Company.jsp</startupUrl>
          </startupUrls>
          <jvmArgs>
            <arg>-Xms1024M</arg>
            <arg>-Xmx2014M</arg>
            <!-- <arg>-javaagent:/home/.m2/repository/.../appengine-java-sdk-1.9.59/lib/agent/appengine-agent.jar </arg>-->             <arg>-javaagent:/home/desarrollo26/Descargas/appengine-java-sdk-1.9.59/lib/agent/appengine-agent.jar </arg>
          </jvmArgs>
        </configuration>
      </plugin>

The src folder contains the structure:

src/
├── main
│   ├── appengine
│   ├── java
│   │   └── com
│   │       └── company
│   │           ├── client
│   │           ├── server
│   │           └── shared
|   |           
│   ├── resources
│   │   └── META-INF
│   └── webapp
       └── WEB-INF
│           ├── classes
│           │   ├── com
│           │   │   └── company
            │   │       └── shared
│           │   ├── main
│           │   │   ├── java
│           │   │   └── resources
│           │   └── META-INF
│           └── lib
│               └── lib
├── META-INF
└── test
    └── java

(All modules.gwt.xml files are at the same level of client/ server/ and shared/ folders.(

From Eclipse, I can create a launcher to compile my project with all the params that I have specified in my POM file but I can't automatically execute the war explode and copy process (this is the main reason for build the project from Maven).

Can I solve that compilation process with my project structure? Con I use the GWT Eclipse project and Maven together?

Thanks!

1

There are 1 answers

0
Thomas Broyer On

You need to use one execution per module to compile.

That being said, you really should split your project into (at least) 5 Maven submodules (one for the server-side code, and on per GWT module, and possibly additional ones for shared code; and you could use the gwt-app and gwt-lib packagings for the GWT modules to simplify your POM files)