maven的搭建的web项目,webversion默认是2.3,jdk默认是1.5

一、Web Version修改

首先看到这个下面这个界面(没有这个view的话,Window-》Show View-》Navigator)


打开我选中的org.eclipse.wst.common.project.facet.core.xml这个文件

原内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="2.3"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.8"/>
</faceted-project>

修改jst.web这个属性如下:

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="3.0"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.8"/>
</faceted-project>

这样就可以将Web version从默认的2.3修改成3.0

二、JDK Version修改

打开pom.xml文件,找到<build>标签

添加如下标签:

<plugins>
	<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<version>3.0</version>
		<configuration>
			<source>1.8</source>
			<target>1.8</target>
		</configuration>
	</plugin>
</plugins>

三、更新Maven项目

项目右击-》Maven-》Update Project

完成。

这里只是记录了问题的解决方案,但是并不知道原因


猜你喜欢

转载自blog.csdn.net/h996666/article/details/79474458