Appears web.xml is missing and <failOnMissingWebXml> is set to true error pox.xml compilation errors when you create a Maven web project

Create a maven project pom.xml today there are mistakes:

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

This is because you caused because you do not under WEB-INF web.xml caused

solution:

Right-click the project -> Java EE Tools -.> Generate Deployment Descriptor Stub then the system will create web.xml file in src / main / webapp / WEB_INF file plus the next. Error Resolution!

Of course, this method is a solution for web project, if your project is not a web project, then there is another solution is to configure it failOnMissingWebXml in pom file. Specific configuration is as follows:

 1 <build>
 2  
 3   <plugins>
 4  
 5    <plugin>
 6  
 7     <groupId>org.apache.maven.plugins</groupId>
 8  
 9     <artifactId>maven-war-plugin</artifactId>
10  
11     <version>2.6</version>
12  
13     <configuration>
14  
15      <failOnMissingWebXml>false</failOnMissingWebXml>
16  
17     </configuration>
18  
19    </plugin>
20  
21   </plugins>
22  
23  </build>

 

Guess you like

Origin www.cnblogs.com/coder-wf/p/12221942.html