引言
因在Linux环境下载安装RocketMQ的时候,引发了该错误,故有此文。
软件版本信息:Rocket5.0,Maven3.8,Jdk1.8
错误信息
1) [ERROR] mvn <args> -rf :rocketmq-store
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:01 min
[INFO] Finished at: 2022-10-27T02:30:51-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:4.2.2:spotbugs (spotbugs) on project rocketmq-store: Execution spotbugs of goaotbugs:spotbugs-maven-plugin:4.2.2:spotbugs failed: java.util.EmptyStackException -> [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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :rocketmq-store
[root@CentOS6 rocketmq-all-5.0.0-source-release]# mvn -clean
2)[ERROR] mvn <args> -rf :rocketmq-broker
[ERROR] Failed to execute goal com.github.spotbugs:spotbugs-maven-plugin:4.2.2:spotbugs (spotbugs) on project rocketmq-broker: Execution spotbugs of goal com.github.spotbugs:spotbugs-maven-plugin:4.2.2:spotbugs failed: edu.umd.cs.findbugs.ba.AnalysisException: Exeption was thrown during analysis: java.lang.OutOfMemoryError: GC overhead limit exceeded -> [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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :rocketmq-broker
答案
官方给出RocketMQ的mvn编译命令添加参数:-Dcheckstyle.skip
mvn -Prelease-all -DskipTests clean install -U #官方的命令(总是报rocketmq-store或者rocketmq-broker的错误)
mvn -Prelease-all -DskipTests -Dcheckstyle.skip clean install -U #添加参数,跳过检查,即可解决
在CentOS6.5的测试效果,成功!
在CentOS7.9的测试效果,成功!
特别注意:务必在RocketMQ的解压根目录下执行mvn编译(无需在distribution目录进行mvn编译),否则还会报其他的错误。
处理过程
因为,在网上找不到解决错误的答案,就自己尝试着解决
1、更换不同版本的JDK,反复尝试,始终出现上述错误
包括使用yum install java-1.8.0-openjdk-devel -y命令(最终安装在了/usr/lib/jvm中)
2、更换不同版本的Maven,问题依然存在。
最终,在一篇windows版本安装RocketMQ的博客看到,需要添加-Dcheckstyle.skip参数,可以解决编译报错问题。
尾言
截止目前为止,网上没找到该错误的直接解决方案,更有甚者用关键字“[ERROR] mvn <args> -rf :rocketmq-store”搜寻,根本搜寻不到相关帖子。故此,写了该篇博文,希望能对后来者有所启示。
如果对你有所启示或帮助,赶快点赞收藏吧!