问题现象:mac本运行maven package时报错
INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gatewayinterfacemodel ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 231 source files to /Users/zhaoxj/WorkspacesIdea/gatewayInterfaceModel/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] javac: ��Ч�ı�־�� -parameters
�÷�: javac <options> <source files>
-help �����г����ܵ�ѡ��
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.740 s
[INFO] Finished at: 2020-12-16T17:42:02+08:00
[INFO] Final Memory: 20M/228M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project gatewayinterfacemodel: Compilation failure
[ERROR] javac: ��Ч�ı�־�� -parameters
[ERROR] �÷�: javac <options> <source files>
[ERROR] -help �����г����ܵ�ѡ��
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
配置了两个jdk,使用maven时,要给maven指定jdk,就要在vim ~/.mavenrc中配置:export JAVA_HOME=$(/usr/libexec/java_home)
配置jdk和maven
vim ~/.bash_profile
export JAVA_6_HOME=/Library/Java/JavaVirtualMachines/1.6.0_65-b14-462.jdk/Contents/Home
export JAVA_8_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contets/Home
export JAVA_HOME=$JAVA_8_HOME
alias jdk6="export JAVA_HOME=$JAVA_6_HOME"
alias jdk8="export JAVA_HOME=$JAVA_8_HOME"
export MAVEN_HOME=/Users/zhaoxj/ProgramFiles/maven/apache-maven-3.2.5
export PATH=$PATH:$MAVEN_HOME/bin
source ~/.bash_profile
vim ~/.mavenrc
export JAVA_HOME=$(/usr/libexec/java_home)
最好重启机器