Error assembling WAR: webxml attribute is required

Because of laziness, two methods are usually used when creating a maven project:
1. Copy an existing maven project, and then modify it;
2. Create a new WEB project, and then convert it into a maven project;
the first Methods are a good way to reuse, which is one of the meanings of building a framework, not [smile].
Stop gossip and get to the point. I'm going to use some fancy technology, so I'm going to rebuild an environment. The second method mentioned above is used to build. After all kinds of configurations are done, maven builds, and the build goes wrong. The error message is as follows:

Pay attention to the key sentence in the above picture: webxml attribute is required and web.xml is required. Looking back at the project, the screenshot of the project is as follows:

You can see that there is web.xml, then the problem comes, why is there, but when maven builds, it says that it cannot be found?
The reason is very simple:
when creating a new dynamic web project, the webroot created by default is: WebContent, and the default webroot of maven's web project is src\main\webapp. The above exception is thrown if web.xml is not found in this directory.
There are two solutions:
1. Delete the WebContent folder and create a new folder: src/main/webapp
2. Configure the path of the webroot in the pom.xml file, as shown in the figure below:

So far, the problem has been solved.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326571346&siteId=291194637
Recommended