在maven的默认配置中,对于jdk的配置是1.4版本,那么建立/导入maven工程过程当中,工程中未指定jdk版本。apache
对工程进行maven的update,就会出现工程依赖的JRE System Library会自动变成JavaSE-1.4。maven
解决方案1:修改maven的默认jdk配置ui
maven的conf\setting.xml文件中找到jdk配置的地方,修改以下:code
<profile> <id>jdk1.6</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.6</jdk> </activation> <properties> <maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.target>1.6</maven.compiler.target> <maven.compiler.compilerVersion>1.6</maven.compiler.compilerVersion> </properties> </profile>
解决方案2:修改项目中pom.xml文件,这样避免在导入项目时的jdk版本指定xml
打开项目中pom.xml文件,修改以下:get
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build>