如何在eclipse中使用maven在gwt中创建.war文件?

时间:2016-03-16 10:12:01

标签: java maven gwt war

我想创建一个我的GWTApp战争。根据许多教程,我将创建一个包如下 -

 <package>war</package>
pom.xml中的

。但是当我在tomcat部署战争时,它会显示404错误。战争不包含任何主页或依赖。

以下是我的pom.xml文件 -

  <modelVersion>4.0.0</modelVersion>
    <groupId>testing</groupId>
    <artifactId>testing</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

 <dependencyManagement>
   <dependencies>
    <dependency>
      <groupId>com.google.gwt</groupId>
    <artifactId>gwt</artifactId>
    <version>2.7.0</version>
    <type>pom</type>
    <scope>import</scope>
   </dependency>
   </dependencies>
 </dependencyManagement>
  <dependencies>
   <dependency>
     <groupId>com.google.gwt</groupId>
     <artifactId>gwt-user</artifactId>
     <scope>provided</scope>
    </dependency>
   <dependency>
     <groupId>com.google.gwt</groupId>
     <artifactId>gwt-dev</artifactId>
      <scope>provided</scope>
     </dependency>
    <dependency>
      <groupId>com.google.gwt</groupId>
      <artifactId>gwt-codeserver</artifactId>
     <scope>provided</scope>
   </dependency>
<dependency>
  <groupId>com.google.gwt</groupId>
  <artifactId>gwt-servlet</artifactId>
  <scope>runtime</scope>
</dependency>
</dependencies>
   <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
       <excludes>
         <exclude>**/*.java</exclude>
       </excludes>
     </resource>
   </resources>
    <plugins>
      <plugin>
<!--         <artifactId>maven-compiler-plugin</artifactId> -->
       <artifactId>maven-war-plugin</artifactId>
<!--         <version>3.1</version> -->
        <configuration>
        <webXml>\mavenWorkspace\testing\war\WEB-INF\web.xml</webXml>
        <source/>
        <target/>
      </configuration>
    </plugin>
  </plugins>
</build>  

和战争结构就像

war
   META-INF
    -maven
    -manifest
   WEB-INF
    -classes
    -lib
   -web.xml

和lib文件夹仅包含gwt-servlet.jar

1 个答案:

答案 0 :(得分:0)

您的项目中似乎没有gwt-maven-plugin。 GWT需要编译步骤,因此请尝试添加。