Solving the error of creating a new Maven project pom file in Eclipse.

title: "Solving the error of creating a new Maven project pom file in Eclipse"
date: "2015-12-08"

  • "dynamic-web-module-3-0"
  • "eclipse"
  • "failonmissingwebxml"
  • "jdk"
  • "maven"

Recently, I created a Maven project in Eclipse and encountered an error in the pom.xml file: "web.xml is missing and is set to true".

After investigating, I found that the project did not generate a web.xml file, which is related to the newer versions of JDK and Eclipse, where the default mechanism is to generate projects using Dynamic Web Module 3.0.

In general, we would copy a web.xml file and modify it for our own project. However, there is a simpler method:

org.apache.maven.plugins maven-war-plugin false

By adding these lines of code, we no longer need a web.xml file.

Okay, the problem is resolved! Setting failOnMissingWebXml to false means ignoring the detection mechanism for a missing web.xml file. It is worth mentioning that in the era of Dynamic Web Module 3.0 projects, there is no need for a web.xml file to register related content, so the project does not generate a web.xml file by default.

Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.