Java version automatically change to java 1.5 after maven update

前端 未结 11 538
盖世英雄少女心
盖世英雄少女心 2020-12-22 17:29

I am using eclipse as IDE. When I right click on the project and then click maven update my java version change to 1.5. Here is what I did so far, I followed all the steps l

11条回答
  •  长情又很酷
    2020-12-22 18:14

    The root-cause of this issue is that if for any reason Eclipse's cannot resolve a valid value for the maven.compiler.source property when generating/updating the .classpath file from the pom, it will simply default to using org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5.

    As expertly answered by @jorge-campos, there are multiple ways to set that property.

    However, Jorge's answer didn't appear to work for me. Here were my settings:

    
        1.8
        ${java.version}
        ${java.version}
    
    

    ...

    Exactly. ${java.version} is never going to resolve to the (completely different) property javaVersion and Eclipse ignored the property and used the default.

    Which brings me back to the "for any reason" part I opened with; developer stupidity can be one of those reasons.

提交回复
热议问题