Solve web.xml is missing and is set to true error

I encountered the following error message when learning maven modular construction project:

web.xml is missing and <failOnMissingWebXml> is set to true.

At this time, you need to right-click the project——>Java EE Tools——>Generate Deployment Descriptor Stub. Then the system will create a web.xml file in the src/main/webapp/WEB_INF file. Error resolved!

Of course, this method is a solution for web projects. If your project is not a web project, there is another solution, which is to configure failOnMissingWebXml in the pom file. The specific configuration is as follows:

<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>

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *