Tag Archives: SpringBoot 2.4

Springboot 2.4 package error, missing web.xml

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.