【英文】解决打war包时没有web.xml文件

Preface

When developing a JavaWeb project, if annotations are used for configuration, there will be no web.xml file created. In this case, an error will occur during packaging: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project SpringDemo: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

Solution

pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>

Completed

References

哔哩哔哩——黑马程序员