Maven工程提示错误信息:web.xml is missing and <failOnMissingWebXml> 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后,要將項目重新部署,这样配置文件才能生效。

猜你喜欢

转载自blog.csdn.net/pcwl1206/article/details/82961204
今日推荐