我想看看我们是否可以从当前的遗留(mojo) GWT Maven插件迁移到新一代(ltgt) Maven插件。我读过一些文档,如http://www.g-widgets.com/2016/12/02/gwt-tip-working-with-maven-multi-modules-projects/,其中概述了如何将代码设置为单独的maven (POM)模块。考虑到我们已经有了项目设置,其中应用程序有多个GWT模块,所有这些模块都是同一个POM的一部分,无论如何,我们可以使用插件来成功编译代码,还是每个模块必须分离成自己的maven模块?
发布于 2018-11-07 13:03:31
不需要更改项目的结构,尽管您将错过通过maven模块(而不是与gwt模块混淆)的客户端代码和服务器代码的清晰分离。
因此,这里有一个例子说明了如何使用新的GWT maven插件而不需要多个maven模块:
只有一个Maven模块的示例项目结构: https://github.com/branflake2267/Archetypes/tree/master/archetypes/gwt-basic-rpc
如果在一个maven模块中有多个GWT模块,则必须指定多个执行。(与旧插件不同):
具有多个GWT模块的示例插件配置:
<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>插件网站上也有一个小迁移指南。
如果您曾经感兴趣的话,那么适当的多模块设置将如何看起来像请看这里。
https://stackoverflow.com/questions/53180217
复制相似问题