gwt maven war插件配置问题

gwt maven war插件配置问题,gwt,maven,mojo,Gwt,Maven,Mojo,我正在maven中开发一个gwt应用程序。在本文中,我使用的是maven war插件。一切正常。当我发出mvn install命令时,它会在目标文件夹中构建abc.war文件。但它没有将编译后的javascript文件(module1“和module2”目录存在于target)复制到war目录。我想在war目录中获取新编译的javascript文件。如何做到这一点 pom.xml文件 <?xml version="1.0" encoding="UTF-8"?> <project

我正在maven中开发一个gwt应用程序。在本文中,我使用的是maven war插件。一切正常。当我发出mvn install命令时,它会在目标文件夹中构建abc.war文件。但它没有将编译后的javascript文件(module1“和module2”目录存在于target)复制到war目录。我想在war目录中获取新编译的javascript文件。如何做到这一点

pom.xml文件

<?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>

4.0.0
例子
例子
战争
12
gwt maven原型项目
2.1.0
假的
真的
1.
C:\ProgramFiles\Java\jdk1.6.0\U 22
abc
war/WEB-INF/classes
org.apache.maven.plugins
maven编译器插件
真的
${JAVA\u HOME}\bin\JAVA.exe
1.6
1.6
1.6
org.codehaus.mojo
GWTMaven插件
2.1.0        
编译
生成同步
合并WebXML
测试
**/client/***/Service.java
${noServer}
${noServer}
com.abc.example.Module1
com.abc.example.Module2
com.abc.example.Module1/Module1.jsp
8080
-Xmx1024m-Xms1024m-Xss1024k-Dgwt.jjs.permutationWorkerFactory=com.google.gwt.dev.ThreadedPermutationWorkerFactory
战争
${basedir}/war
${basedir}/war/WEB-INF/WEB.xml
maven antrun插件
进程类
跑
org.apache.maven.plugins
maven战争插件
2.1-β-1
${basedir}/war
${basedir}/war/WEB-INF/WEB.xml
war/WEB-INF/classes/context/context.xml
.gwt tmp/**
org.codehaus.mojo
cobertura maven插件
清洁的
org.apache.maven.plugins
maven surefire插件
2.4.2
-Xmx1024m
${skipTest}
maven清洁插件
2.2
战争/模块1
战争/模块2
war/WEB-INF/lib
src/main/resources
**/公共/资源/**
**/公众/图像/**
真的
src/main/resources/build/build-${env}.properties
真的
发展
发展
org.codehaus.mojo
cobertura maven插件

虽然我不熟悉使用maven的基于gwt的应用程序,但maven war插件允许。您可以在maven war插件部分添加类似于以下内容的内容

      <webResources>
        <resource>
          <directory>${project.build.directory}</directory>              
          <targetPath>war</targetPath>
          <includes>
            <include>module1/**</include>
            <include>module2/**</include>
          </includes>
        </resource>
      </webResources>

${project.build.directory}
战争
模块1/**
模块2/**
添加

 <inplace>true</inplace>  
true

在gwt maven插件中,配置标签解决了这个问题。

谢谢,非常感谢