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技術

          主站蜘蛛池模板: 金阳县| 威海市| 赤峰市| 腾冲县| 大方县| 大化| 游戏| 安吉县| 会同县| 四川省| 甘泉县| 伊宁市| 平遥县| 凉山| 岚皋县| 简阳市| 通江县| 团风县| 徐州市| 和田市| 拜城县| 古丈县| 马公市| 济南市| 都昌县| 屏东市| 栾川县| 鸡东县| 海晏县| 滨海县| 贵阳市| 讷河市| 周口市| 刚察县| 长治市| 招远市| 济南市| 固镇县| 丹阳市| 静乐县| 天津市|