Exception occurred during packaging in springboot 2.4:
The details are as follows:
Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project pts_job:
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
The reason is the lack of web.xml. It doesn’t make sense. The springboot project doesn’t need this file. The main reason is that the servlet version in Maven war plugin is too low. It is required to have a web.xml file.
The solution is to upgrade its version. Here, the following version is used:
<build> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>3.2.0</version> </plugin> </build>
After adding its plug-in, it can be packaged successfully.
Similar Posts:
- Maven warnning: ‘build.plugins.plugin.version’ is missing [How to Solve]
- [Solved] Spring Boot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0
- [Solved] Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
- [Solved] SpringBoot Package Error: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-res
- [Solved] Dynamic Web Module 3.0 requires Java 1.6 or newer
- Solve the error in Maven project packaging: error injecting constructor
- [Solved] Spring Start Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project gulimall-coupon: There are test failures. Please refer to D:\m1\0613\mall-coup
- Maven no main manifest attribute when generate jar for project
- How to Solve Error: spring-boot-maven-plugin not found
- Springboot always reports an error when importing JSP dependencies