cuiyi's blog(崔毅 crazycy)

          記錄點滴 鑒往事之得失 以資于發展
          數據加載中……

          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項目默認的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 閱讀(2906) 評論(0)  編輯  收藏 所屬分類: JavaEE技術

          主站蜘蛛池模板: 邢台县| 台中县| 如皋市| 兴宁市| 泰顺县| 洮南市| 龙山县| 南京市| 大邑县| 佛冈县| 乌鲁木齐市| 珠海市| 航空| 永清县| 辛集市| 平舆县| 安远县| 连江县| 新疆| 石景山区| 永寿县| 武定县| 莱西市| 长汀县| 陈巴尔虎旗| 来凤县| 房产| 青川县| 延吉市| 会东县| 安庆市| 安岳县| 台南县| 宜昌市| 惠水县| 区。| 井陉县| 灵石县| 额尔古纳市| 高唐县| 兴宁市|