Maven添加Web.xml的方法


當創建maven工廠時沒有web.xml文件
1.點擊你的項目名稱,進入到Myeclipse的-- Project Facets上,
2.點擊Dynamic Web Module 和下面的Java,將兩個框選中

3.點擊你右手邊的Runtimes里的Tomcat,選中,然后點ok

 


4.查看你的項目的target下面會多出一個WebRoot文件,你把里面的文件復制到Src--Main--webapp下面

 


5.刪除你的WebRoot
6.點擊你的項目名稱,進入到Properties,點擊MyEclipse的Deployment Assembly

 

7.刪除你的WebReoot,點擊add--Folder在src--main--webapp下面創建文件

8.點擊add添加java build path Entries 這樣你的maven文件就可以正常運行了。

 

如果遇到web.xml is missing and <failOnMissingWebXml> is set to true  直接復制上去

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SSH</groupId>
<artifactId>SSH</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<webVersion>3.1</webVersion>
</properties>
<plugs>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugs>
<build/>

 


免責聲明!

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



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