eclipse中使用maven建立專案JDK版本預設是1.5解決方法
阿新 • • 發佈:2018-12-25
請看解決方案:
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版本自動重新整理。
請看解決方案:
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版本自動重新整理。