centos下maven install出错 No compiler is provided in this environment

maven centos 文章 2022-07-27 22:13 782 0 全屏看文

AI助手支持GPT4.0

在centos下我安装的我以为的jdk1.8

yum install jdk

然后我执行了maven命令

mvn install

结果提示:

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR]
[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


搜了网上文章后得知,maven install jdk 并不会下载完整版JDK 只是下载了jre。我们需要运行:

yum install -y java-devel

image.png

等安装好后,我们再次执行

mvn install

然后就执行成功了。

image.png

-EOF-

AI助手支持GPT4.0