請看解決方案:
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版本自動刷新。