Maven “build path specifies execution environment J2SE-1.5”, even though I changed it to 1.7

后端 未结 11 1515
天涯浪人
天涯浪人 2020-11-27 12:00

In Eclipse Juno, I installed the latest m2e plugin (1.2.20120903-1050). In preferences, I have added jdk1.7.0_11 in Java -> Installed JREs -> Add, and then specified the lo

11条回答
  •  迷失自我
    2020-11-27 12:54

    All of the answers above may work for the time being but whenever you run maven on the command line or Maven → Update project… the JDK will be reset, this was also the question as I understand it.

    To fix this for good add the following code to your pom file. Remember to do a Maven → Update project… afterwards or mvn clean compile at the command line.

    
        
            
                
                    org.apache.maven.plugins
                    maven-compiler-plugin
                    3.1
                    
                        1.7
                        1.7
                    
                
            
    
        
    
    

提交回复
热议问题