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 閱讀(2887) 評論(0)  編輯  收藏 所屬分類: JavaEE技術

          主站蜘蛛池模板: 枣阳市| 南京市| 兰西县| 凌海市| 连江县| 东阳市| 赫章县| 绥芬河市| 习水县| 徐州市| 延寿县| 靖西县| 临安市| 安龙县| 两当县| 磐安县| 攀枝花市| 德令哈市| 临西县| 阜城县| 周至县| 武隆县| 江口县| 长沙县| 齐齐哈尔市| 轮台县| 什邡市| 韶关市| 长汀县| 左权县| 太仆寺旗| 新宾| 济南市| 嘉黎县| 建湖县| 信丰县| 邯郸市| 临安市| 涟水县| 长宁县| 深州市|