Maven部署Web项目报错webxml attribute is required

来源:互联网 发布:中世纪2 优化9 兵种 编辑:程序博客网 时间:2024/04/29 20:20

mvn package一个web项目时,报错如下:Error assembling WAR:webxml attribute is required

原因:

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

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

<plugin>            <groupId>org.apache.maven.plugins</groupId>            <artifactId>maven-war-plugin</artifactId>            <version>2.4</version>            <configuration>                 <webXml>webapps\WEB-INF\web.xml</webXml>                    </configuration>        </plugin>    
或者把webapps改成默认的webapp



0 0
原创粉丝点击