1. 程式人生 > >Maven工程提示錯誤資訊:web.xml is missing and is set to true

Maven工程提示錯誤資訊:web.xml is missing and is set to true

先看下錯誤資訊提示:大概的意思就是建立的Web工程的web.xml檔案缺失,那麼很容易就可以想到兩種解決辦法:

1、將Maven工程預設需要web.xml這一配置改為false

2、在src/main/webapp/WEB-INF下建立一個web.xml檔案

1、將Maven工程預設需要web.xml這一配置改為false

在pom.xml檔案中配置以下內容:

<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、在src/main/webapp/WEB-INF下建立一個web.xml檔案

在src/main/webapp/WEB-INF建立完web.xml後,要將專案重新部署,這樣配置檔案才能生效。