在maven 打包war包的时候,它会要求/WEB-INF目录下有web.xml文件,但是在servlet 3.0之后,对于web.xml文件本身是可选的,当我用maven打包的时候报错如下错误:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project core-frontend: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
解决方式有两个:
1 在pom.xml文件中定义一个参数配置
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
2 另外你可以更新maven的默认的maven-war-plugin
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
</plugin>
https://www.mkyong.com/maven/maven-webxml-attribute-is-required/