pom.xml報錯web.xml is missing and is set to true


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

  原因是在項目中缺少web.xml,且<failOnMissingWebXml>被設置成了true

  解決方法:a.如果項目需要web.xml,去復制一個web.xml到項目中即可。

          也可以使用Eclipse生成:有如下兩種方式

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

          2.右擊項目——>Properties——>Project Facets  將Dynamic Web Module的勾去掉,點擊Apply,再重新勾上,點擊下方出現的Further configuration availber,再選擇生成的目錄即可生成web.xml

        

         

 

      b.如果項目不需要web.xml,則需要在pom.xml中將<failOnMissingWebXml>配置成false,有如下兩種配置方式

      1.

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

      2.

<properties>
    <failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

 


免責聲明!

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



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