gwt maven war插件配置问题 [英] gwt maven war plugin configuration problem

查看:130
本文介绍了gwt maven war插件配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个gwt应用程序。在这个我使用的Maven战争插件。一切正常。当我给 mvn install 命令时,它会在目标文件夹中生成 abc.war 文件。但它并未将编译后的JavaScript文件( target 中存在的 module1 module2 目录)复制到war目录。我想在战争目录中获得新编译的JavaScript文件。如何实现这一目标?



pom.xml文件

 <?xml version = 1.0encoding =UTF-8?> 
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">

< modelVersion> 4.0.0< / modelVersion>
< groupId>示例< / groupId>
< artifactId>示例< / artifactId>
<包装>战争< / packaging>
< version> 12< / version>
< name> gwt-maven-archetype-project< / name>

<属性>
<! - 方便在一个地方定义GWT版本 - >
< gwt.version> 2.1.0< /gwt.version>
< noServer> false< / noServer>
< skipTest> true< / skipTest>
< JAVA_HOME> C:\ Program Files \Java\jdk1.6.0_22< / JAVA_HOME>
<! - 方便地在一个地方定义Spring版本 - >
< / properties>

<依赖关系>
<! - 所需的依赖关系 - >
< /依赖关系>
< build>
< finalName> abc< / finalName>
< outputDirectory> war / WEB-INF / classes< / outputDirectory>
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
<配置>
<详细>真< /详细>
< executable> $ {JAVA_HOME} \bin\java.exe< / executable>
< compilerVersion> 1.6< / compilerVersion>
< source> 1.6< / source>
< target> 1.6< / target>
< / configuration>
< / plugin>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> gwt-maven-plugin< / artifactId>
< version> 2.1.0< / version>
<执行次数>
<执行>
<目标>

< goal>编译< / goal>
< goal> generateAsync< / goal>
< goal> mergewebxml< / goal>
< goal> test< / goal>
< /目标>
< /执行>
< /执行次数>
<配置>
< servicePattern> ** / client / ** / * Service.java< / servicePattern>
< noServer> $ {noServer}< / noServer>
< noserver> $ {noServer}< / noserver>
<模块>
< module> com.abc.example.Module1< / module>
< module> com.abc.example.Module2< / module>
< / modules>
< runTarget> com.abc.example.Module1 / module1.jsp< / runTarget>
< port> 8080< / port>
< extraJvmArgs> -Xmx1024m -Xms1024m -Xss1024k -Dgwt.jjs.permutationWorkerFactory = com.google.gwt.dev.ThreadedPermutationWorkerFactory< / extraJvmArgs>
< hostedWebapp> war< / hostedWebapp>
< warSourceDirectory> $ {basedir} / war< / warSourceDirectory>
< webXml> $ {basedir} /war/WEB-INF/web.xml</webXml>
< / configuration>
< / plugin>
< plugin>
< artifactId> maven-antrun-plugin< / artifactId>
<执行次数>
<执行>
<阶段>程序类< /阶段>
<配置>
< / configuration>
<目标>
< goal>跑步< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-war-plugin< / artifactId>
< version> 2.1-beta-1< / version>
<配置>
< warSourceDirectory> $ {basedir} / war< / warSourceDirectory>
< webXml> $ {basedir} /war/WEB-INF/web.xml</webXml>
<! - < webXml> src / main / webapp / WEB-INF / web.xml< / webXml> - >
< containerConfigXML> war / WEB-INF / classes / context / context.xml< / containerConfigXML>
< warSourceExcludes> .gwt-tmp / **< / warSourceExcludes>
< / configuration>
< / plugin>

< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> cobertura-maven-plugin< / artifactId>
<执行次数>
<执行>
<目标>
< goal> clean< / goal>
< /目标>
< /执行>
< /执行次数>
< / plugin>

< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-surefire-plugin< / artifactId>
< version> 2.4.2< / version>
<配置>
< argLine> -Xmx1024m< / argLine>
< skipTests> $ {skipTest}< / skipTests>
< / configuration>
< / plugin>
< plugin>
< artifactId> maven-clean-plugin< / artifactId>
< version> 2.2< / version>
<配置>
<档案集>
< fileset>
< directory> war / module1< / directory>
< / fileset>

< fileset>
< directory> war / module2< / directory>
< / fileset>
< fileset>
< directory> war / WEB-INF / lib< / directory>
< / fileset>
< / filesets>
< / configuration>
< / plugin>
< / plugins>
<资源>
< resource>
<目录> src / main / resources< /目录>
<排除>
< exclude> ** / public / resources / **< / exclude>
< exclude> ** / public / images / **< / exclude>
< /不包括>
<过滤>真实< /过滤>
< / resource>
< /资源>
< filters>
< filter> src / main / resources / build / build - $ {env} .properties< / filter>
< / filters>
< / build>
<个人资料>
<个人资料>
<激活>
< activeByDefault> true< / activeByDefault>
< / activation>
< id> dev< / id>
<属性>
< env> dev< / env>
< / properties>
< / profile>


< / profiles>
<报告>
< plugins>
< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> cobertura-maven-plugin< / artifactId>
< / plugin>
< / plugins>
< / reporting>


解决方案

添加

 < inplace> true< / inplace> 

在gwt-maven-plugin配置标签中解决了这个问题。

I am developing a gwt application in maven. In this I am using maven war plugin. Everything works fine. When I give mvn install command it builds abc.war file in target folder. But it is not copying compiled javascript files ("module1" and "module2" directories present in target) to war directory. I want to get newly compiled javascript files in war directory. How to achieve this?

pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>example</artifactId>
<packaging>war</packaging>
<version>12</version>
<name>gwt-maven-archetype-project</name>

<properties>
    <!-- convenience to define GWT version in one place -->
    <gwt.version>2.1.0</gwt.version>
    <noServer>false</noServer>
    <skipTest>true</skipTest>
    <gwt.localWorkers>1</gwt.localWorkers>
    <JAVA_HOME>C:\Program Files\Java\jdk1.6.0_22</JAVA_HOME>
    <!-- convenience to define Spring version in one place -->      
</properties>

<dependencies>
    <!-- Required dependencies-->
</dependencies>
<build>
    <finalName>abc</finalName>
    <outputDirectory>war/WEB-INF/classes</outputDirectory>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <verbose>true</verbose>
                <executable>${JAVA_HOME}\bin\java.exe</executable>
                <compilerVersion>1.6</compilerVersion>
                <source>1.6</source>
                <target>1.6</target>                                            
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>       
            <version>2.1.0</version>        
            <executions>
                <execution>
                    <goals>

                        <goal>compile</goal>
                        <goal>generateAsync</goal>
                        <goal>mergewebxml</goal>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <servicePattern>**/client/**/*Service.java</servicePattern>
                <noServer>${noServer}</noServer>
                <noserver>${noServer}</noserver>
                <modules>
                <module>com.abc.example.Module1</module>
                <module>com.abc.example.Module2</module>
                </modules>
                <runTarget>com.abc.example.Module1/module1.jsp</runTarget> 
                <port>8080</port>
                <extraJvmArgs>-Xmx1024m -Xms1024m -Xss1024k -Dgwt.jjs.permutationWorkerFactory=com.google.gwt.dev.ThreadedPermutationWorkerFactory</extraJvmArgs>
            <hostedWebapp>war</hostedWebapp>
              <warSourceDirectory>${basedir}/war</warSourceDirectory>
               <webXml>${basedir}/war/WEB-INF/web.xml</webXml>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <configuration>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1-beta-1</version>
            <configuration>
                <warSourceDirectory>${basedir}/war</warSourceDirectory>
                 <webXml>${basedir}/war/WEB-INF/web.xml</webXml>
                <!--<webXml>src/main/webapp/WEB-INF/web.xml</webXml>-->
                <containerConfigXML>war/WEB-INF/classes/context/context.xml</containerConfigXML>
                <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>                                              
            </configuration>
        </plugin>

           <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <argLine>-Xmx1024m</argLine>
                 <skipTests>${skipTest}</skipTests>
            </configuration>
        </plugin>
         <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>war/module1</directory>
                    </fileset>

                    <fileset>
                        <directory>war/module2</directory>
                    </fileset>
                    <fileset>
                        <directory>war/WEB-INF/lib</directory>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
    </plugins>
    <resources>
        <resource>
            <directory>src/main/resources</directory>               
            <excludes>
                <exclude>**/public/resources/**</exclude>
                <exclude>**/public/images/**</exclude>
            </excludes>             
            <filtering>true</filtering>
        </resource>
    </resources>
    <filters>
        <filter>src/main/resources/build/build-${env}.properties</filter>
    </filters>
</build>
<profiles>
    <profile>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <id>dev</id>
        <properties>
            <env>dev</env>
        </properties>
    </profile>


</profiles>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
        </plugin>
    </plugins>
</reporting>

解决方案

Adding

 <inplace>true</inplace>  

in the gwt-maven-plugin configuration tags solved the issue.

这篇关于gwt maven war插件配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆