web.xml is missing and is se


摘要
maven模塊化

在學習maven模塊化構建項目的時候遇到了如下報錯信息:

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

。這時候需要右擊項目——>Java EE Tools——>Generate Deployment Descriptor Stub.然后系統會在src/main/webapp/WEB_INF文件加下創建web.xml文件。錯誤解決!

當然這個方法是針對web項目的解決方案,如果你的工程不是web項目,那么還有另外一種解決方案,就是在pom文件中配置一下failOnMissingWebXml。具體配置如下:

 

 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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM