系统升级后执行 mvn 命令,总是出现以下错误:
No compiler is provided in this environment. Perhaps you are running on a JRE
这时候先排除Java环境变量问题,配置完后执行
java -version
如果正常输出则继续验证Maven
mvn -v
如果打印信息中 runtime
后面的地址不是JavaVirtualMachine地址
如下面这种情况:
mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3
Java version: 1.8.0_281, vendor: Oracle Corporation, runtime: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
可删除JavaAppletPlugin.plugin文件或者修改后缀备份
之后再验证Maven信息,信息正常则可继续编译代码