我试图在另一场战争中重用一个组装的gwt编译.为此,我尝试将当前的maven模块的包装从战争改为pom.然后我计划使用maven-assembly-plugin压缩gwt的模块js输出,并在以后的另一个war模块中使用它
我尝试从< packaging> war< / packaging>更改包装标签to< packaging> pom< / packaging>在Validation sample的pom.xml中. gwt-maven-plugin永远不会进入编译阶段.相反,它跳过编译!!!!!
>发生了什么事?
>这是预期的吗?
>有没有解决方法?
>将所有gwt示例打包为习惯(.war),如果您有私有maven repo,请安装mvn install或mvn deploy.
>创建一个类型为war的空maven模块,没有代码但有maven文件夹结构,你可以在这里添加你需要的任何其他东西,如全局src / main / webapp / index.html.
>配置新模块以使用如下所示的maven-dependency-plugin,并运行mvn 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>
最后,与gwt-maven-plugin相关,就像任何其他maven插件一样,选择适当的pom-packaging生命周期阶段(打包,安装或部署)就足够了:
... <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>
不幸的是,当包装是pom时,gwt-maven-plugin特别禁止编译,请看一下line #269 of CompileMojo.java