-
maven install web项目时遇到
[ERROR] Failed to execute goal org.apache.maven.plugins:
maven-war-plugin:2.2:war (default-war) on project good:
Error assembling WAR: webxml attribute is required
(or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
· 原因:maven的web项目默认的webroot是在src\main\webapp。如果在此目录下找不到web.xml就抛出以上的异常。
· 解决:pom.xml 文件添加如下插件内容
<build>
<finalName>web-app-name</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<webXml>web\WEB-INF\web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>