简体   繁体   English

如何在Eclipse中使用Maven在gwt中创建.war文件?

[英]How to create a .war file in gwt using maven in eclipse?

I want to create a war of my GWTApp. 我想打我的GWTApp。 According to many tutorials I would have create a package as follows - 根据许多教程,我将创建一个如下的程序包-

 <package>war</package>

in pom.xml . pom.xml But when I deploy the war on tomcat it show me 404 Error. 但是,当我在tomcat上展开战争时,它显示404错误。 The war does not contain any host page or dependency. 战争不包含任何主机页面或依赖项。

The following is my pom.xml file - 以下是我的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>  

and war structure is like 战争结构就像

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

and lib folder contain only gwt-servlet.jar . 和lib文件夹仅包含gwt-servlet.jar

It looks like you don't have the gwt-maven-plugin in your project. 看起来您的项目中没有gwt-maven-plugin。 GWT requires a compile step, so try with adding that. GWT需要一个编译步骤,因此请尝试添加该步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM