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項目默認的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技術

          主站蜘蛛池模板: 内乡县| 井陉县| 永昌县| 阿拉善右旗| 蒙阴县| 郑州市| 苏尼特右旗| 林口县| 禄丰县| 桃园市| 聊城市| 南开区| 常德市| 微博| 金湖县| 收藏| 沿河| 广西| 景泰县| 新疆| 若羌县| 博湖县| 神农架林区| 共和县| 安塞县| 永顺县| 根河市| 安阳县| 平谷区| 博兴县| 格尔木市| 驻马店市| 兰溪市| 武威市| 塘沽区| 交口县| 株洲市| 驻马店市| 铜梁县| 昌图县| 望江县|