2016-03-16 42 views
0

我想創建一個我的GWTApp的戰爭。據很多教程我會創建一個包如下 -如何在eclipse中使用maven在gwt中創建一個.war文件?

<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

+0

如何訪問Web應用程序(URL)?你能從應用服務器發佈堆棧跟蹤嗎? – mlewandowski

+0

我手動主機上的tomcat –

+0

HTTP狀態404這場戰爭 - /testing-0.0.1-SNAPSHOT/ 類型狀態報告 消息/testing-0.0.1-SNAPSHOT/ 描述所請求的資源(/testing-0.0 .1-SNAPSHOT /)不可用。 Apache Tomcat/6.0.24 –

回答

0

看起來你的項目中沒有gwt-maven-plugin。 GWT需要一個編譯步驟,所以試着添加它。

+0

感謝您的迴應,但實際上我沒有這麼多的maven的想法,請你告訴我如何使用此步驟 –

+0

不幸的是,我不現在有一個適當的例子(我的gwt是2.3.0,可能不再工作)。我建議你參加一個現成的GWT示例項目,並與你的項目進行比較。快速谷歌搜尋發送給我:https://github.com/steinsag/gwt-maven-example –

+0

Teemu,讓我試着確認...希望這項工作 –

相關問題