Pom.xml appearance web. XML is missing and <failOnMissingWebXml> are set to true solution

Source: Internet
Author: User

You should be able to read the message. That is, the missing Web. xml file ,<failonmissingwebxml> is set to true.

Search for a bit, the answer on Stack overflow solves the problem, share it.

The most frequently answered text is as follows:

This is a maven error. It says that it was expecting a Web. xml file in your project because it was a, the application by indicated >. However, for recent Web applications A. xml file is totally optional. Maven needs to catch-to-this convention. Add this to your maven for Maven catch up and you pom.xml don ' t need to add a useless to web.xml your project:

The main idea is that this is a MAVEN error, which has become dispensable in recent Web application development. However, Maven has not yet followed this change, as long as we manually add the following configuration in the Pom.xml file:

<Build>    <Plugins>        <plugin>            <groupId>Org.apache.maven.plugins</groupId>            <Artifactid>Maven-war-plugin</Artifactid>            <version>2.6</version>            <Configuration>                <Failonmissingwebxml>False</Failonmissingwebxml>            </Configuration>        </plugin>    </Plugins></Build>

"Tell" maven. The advantage of this is that we do not have to be a useless web. xml file in the project life. In the update version (specifically from which version I do not know ~ ~) in Maven, there is no problem with the Web. xml file missing, we only need to deal with the problem of <failOnMissingWebXml> is set to Tue. That is, add the following configuration to the Pom.xml.

< Properties >    < Failonmissingwebxml >false</failonmissingwebxml></Properties >

Other scenarios: (Generate Web.xml--> Deployment run-time file path)

Can do it also like this:

    1. Right click the Deployment descriptor in Project Explorer.
    2. Select Generate Deployment descriptor Stub.

It would generate Web-inf folder in Src/main/webapp and a Web. XML in it.

This is the adopted scenario, meaning that in the project browser right-click Deloyment descriptor, select Generate deployment Descriptor stub: Generate Deployment descriptor stub.

The Web. xml file is generated in the project's src/main/webapp/web-inf directory after the operation. I generated the Web. xml file in this way, but I still have an error. If you are, you can look down.

Here is the steps you can follow:

    1. You can check the clicking your project, and open its Properties dialogue, and then "Deployment assembly ", where you can add Folder/src/main/webapp. Save the setting, and then,
    2. Go to Eclipse Menu Project--Clean ... and clean the project, and the error should go away.

At this point, you need to deploy the run-time path to the Src/main/webapp file to ensure that the server is running correctly.

This means that you need to deploy the Src/main/webapp (the newly generated web. XML is in this folder) folder, and deployment will copy the corresponding resource to the appropriate directory of the Web server at runtime (via the Deploy path is specified) to ensure that the Web app is running correctly.

After these two steps, the problem is solved.

Pom.xml appearance web. XML is missing and <failOnMissingWebXml> are set to true solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.