cuiyi's blog(崔毅 crazycy)

          記錄點滴 鑒往事之得失 以資于發(fā)展
          數(shù)據(jù)加載中……

          SpringMVC+MyBatis - 16 Maven部署Web項目報錯webxml attribute is required

          Error:
          [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war) on project TradingLink: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

          Cause:
          maven的web項目默認(rèn)的webroot是在src\main\webapp。如果在此目錄下找不到web.xml就拋出以上的異常。

          Solution:
          需要在pom.xml中增加<webResources>配置,如下:

           <build>  
          <plugins>  
              <plugin>  
                  <groupId>org.apache.maven.plugins</groupId>  
                  <artifactId>maven-war-plugin</artifactId>  
                  <version>2.4</version>  
                  <configuration>  
                      <webResources>  
                          <resource>                      
                              <directory>WebContent</directory>  
                          </resource>  
                      </webResources>  
                  </configuration>  
              </plugin>  
          </plugins>  
          </build>  


          或者增加<webXml>配置,如下:

          <build>  
          <plugins>  
              <plugin>  
                  <groupId>org.apache.maven.plugins</groupId>  
                  <artifactId>maven-war-plugin</artifactId>  
                  <version>2.4</version>  
                  <configuration>  
                         <webXml>WebContent\WEB-INF\web.xml</webXml>            
                  </configuration>  
              </plugin>  
          </plugins>  
          </build>  

          posted on 2014-10-02 17:56 crazycy 閱讀(2903) 評論(0)  編輯  收藏 所屬分類: JavaEE技術(shù)

          主站蜘蛛池模板: 桐庐县| 新余市| 太仓市| 宁乡县| 赤峰市| 泰安市| 贞丰县| 图们市| 金乡县| 曲靖市| 平陆县| 鲜城| 呼伦贝尔市| 阿拉善左旗| 北京市| 陇西县| 墨竹工卡县| 碌曲县| 凭祥市| 寻乌县| 翼城县| 望谟县| 霞浦县| 志丹县| 章丘市| 札达县| 上饶县| 会东县| 巴彦淖尔市| 萨嘎县| 方正县| 新化县| 册亨县| 张家川| 林甸县| 法库县| 资溪县| 汝阳县| 泰宁县| 天柱县| 海南省|