Java version automatically change to java 1.5 after maven update

前端 未结 11 503
盖世英雄少女心
盖世英雄少女心 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:19

    Open your pom.xml file and add the following lines on it:

    
       1.8
       1.8
    
    

    Where 1.8 is the java version of your current JDK/JRE. Another way of doing this is adding a with the maven-compile-plugin as

    
    
      
        org.apache.maven.plugins
        maven-compiler-plugin
        3.2 
        
          1.8
          1.8
        
      
    
    
    

    EDIT

    If you are looking for a way to make it work with Java versions 9+ please take a look at @JDelorean's answer down here and don't forget to give him an upvote as well :)

提交回复
热议问题