每次更新Maven的pom.xml後自動修改jre為J2SE-1.5。
然後Eclipse提示“構建路徑指定執行環境 J2SE-1.5。工作空間中沒有與此環境嚴格兼容的 JRE”和“The compiler compliance specified is 1.5 but a JRE 13 is used”。手動修改後。問題可以解決。但老改也不是個事。
I. 解決方法一:手動配置maven默認jre
首先編輯 settings.xml 文件
修改第184行左右的 <profile> 部分為你需要的版本,這裡以我的JDK1.13為例。/<profile>
<code><profile>
jdk-1.13
<activation>
<activebydefault>true/<activebydefault>
1.13
/<activation>
<properties>
<maven.compiler.source>1.13/<maven.compiler.source>
<maven.compiler.target>1.13/<maven.compiler.target>
<maven.compiler.compilerversion>1.13/<maven.compiler.compilerversion>
/<properties>
/<profile>/<code>
II. 解決方法二:修改項目pom.xml文件
在項目的pom.xml文件中添加下面設置,jdk版本修改成需要的版本。
<code><build>
<plugins>
<plugin>
<groupid>org.apache.maven.plugins/<groupid>
<artifactid>maven-compiler-plugin/<artifactid>
<configuration>
<source>1.13/<source>
<target>1.13/<target>
/<configuration>
/<plugin>
/<plugins>
/<build>/<code>
III. OK,搞定問題
閱讀更多 雞蛋牛奶叉燒包 的文章