错误信息:Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project Thesis: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
错误说明:
在创建maven项目的时候,可能出现上诉错误,错误的原因是maven项目默认的web.xml是放在webapp/WEB-INF下的,当web.xml的路径改变了,那么系统就无法识别了,此时需要在pom.xml中通过maven-war-plugin指明web.xml的存放路径。如下:
<!-- 修改webapp目录为WebContent -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- 设置WebContent目录为Web目录 -->
<webappDirectory>WebContent</webappDirectory>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>