創建Maven web項目時 出現 web.xml is missing and is set to true錯誤 pox.xml編譯錯誤


今天創建一個maven項目 pom.xml出現如下錯誤:

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

這是因為你因為你WEB-INF下沒有web.xml導致造成的

解決方案:

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

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

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

以上來自於百度搜到的答案,親測可用

 


免責聲明!

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



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