eclipse中使用maven创建项目JDK版本默认是1.5

1. 修改maven的settings.xml文件。

添加以下行,jdk版本改为自己需要的版本:

复制代码
<profile>  
    <id>jdk-1.7</id> <activation> <activeByDefault>true</activeByDefault> <jdk>1.7</jdk> </activation> <properties> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion> </properties> </profile>
复制代码

2. 在eclipse中检查配置文件是否被引用到,之前我的user settting使用的位置不对。

    然后update setttings。

 3. 最后选择创建的项目,更新项目后,引用的jdk版本自动刷新。

猜你喜欢

转载自www.cnblogs.com/chenlove/p/9317314.html