maven-install报错:webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update

来源:互联网 发布:2015药典 凡例平行数据 编辑:程序博客网 时间:2024/05/17 01:19

maven-install报错:

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


原因:

mavenweb项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常

解决办法:需要在pom.xml中的增加<webResources>配置,如下:

<build><plugins><!-- 配置web.xml的路径,maven的web项目默认的webroot是在src\main\webapp --><plugin>          <groupId>org.apache.maven.plugins</groupId>          <artifactId>maven-war-plugin</artifactId>          <version>2.2</version>        <configuration>               <webXml>webapp\WEB-INF\web.xml</webXml>             </configuration>      </plugin>     </plugins></build>



0 0
原创粉丝点击