Maven can't compile java 1.8

后端 未结 8 1379
旧巷少年郎
旧巷少年郎 2021-02-04 03:39

I\'m trying to use maven to build a jar but I keep getting the error

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 
(d         


        
8条回答
  •  清酒与你
    2021-02-04 04:12

    As a MacOS user, open a Terminal and create or edit a file .bash_profile (in the directory of your user home) and put the following snippet there:

    export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
    

    Save that file and reopen a Terminal instance. If you execute export as a command there, you should see a valid JAVA_HOME with the location of your JDK 8 installation. Restart your IDE afterwards and maven should be able to build you nice java target 1.8 code.

提交回复
热议问题