user1111871
user1111871

Reputation: 147

MIgrating from legacy gwt maven plugin to new generation plugin

I'm looking to see if we can migrate from the current legacy (mojo) GWT Maven plugin to the new generation (ltgt) Maven plugin. I've read documentation such as http://www.g-widgets.com/2016/12/02/gwt-tip-working-with-maven-multi-modules-projects/ which outlines how to setup the code as separate maven (POM) modules. Considering we already have the project setup where the application has multiple GWT modules all part of the same POM is there anyway we can work the plugin to compile the code successfully or does each module have to be separated into maven module of its own?

Upvotes: 1

Views: 545

Answers (1)

Tobika
Tobika

Reputation: 1062

No need to change the structure of your project, though you would be missing out on the clean separation of client and server code via maven modules(not to mix up with the gwt modules).

So said that here is an example of how to use the new GWT maven plugin without having multiple maven modules:
Example Project structure with only one Maven Module: https://github.com/branflake2267/Archetypes/tree/master/archetypes/gwt-basic-rpc

And in case you have multiple GWT modules inside one maven module then you have to specify multiple executions. (not like in the old plugin):
Example Plugin config with multiple GWT modules:

      <plugin>
        <groupId>net.ltgt.gwt.maven</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>compile-module1</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <moduleName>com.example.module1.Module1</moduleName>
              <moduleShortName>module1</moduleShortName>
              <compilerArgs>
                <compilerArg>-localWorkers</compilerArg>
                <compilerArg>4</compilerArg>
                <compilerArg>-draftCompile</compilerArg>
              </compilerArgs>
            </configuration>
          </execution>
          <execution>
            <id>compile-module1</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <moduleName>com.example.module2.Module2</moduleName>
              <moduleShortName>module2</moduleShortName>
              <compilerArgs>
                <compilerArg>-draftCompile</compilerArg>
              </compilerArgs>
            </configuration>
          </execution>
        </executions>
      </plugin>

Also there an little migration guide on the plugin website.
If ever you are interested in how the proper multi module setup would look like see here.

Upvotes: 2

Related Questions