先看看我的报错截图
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:51 min
[INFO] Finished at: 2023-06-04T12:36:47+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean (default-clean) on project chatgpt-juejin: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean failed: Unable to load the mojo 'clean' in the plugin 'org.apache.maven.plugins:maven-clean-plugin:3.2.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/clean/CleanMojo : Unsupported major.minor version 52.0
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-clean-plugin:3.2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/root/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/3.2.0/maven-clean-plugin-3.2.0.jar
[ERROR] urls[1] = file:/root/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.3.4/maven-shared-utils-3.3.4.jar
[ERROR] urls[2] = file:/root/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[3] = file:/root/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[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.ap
走弯路:
面对这个问题,我排查思路是通过最下面的报错信息
即 : Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean (default-clean) on project chatgpt-juejin: Execution default-clean of goal org.apache.maven.plugins:maven-clean-plugin:3.2.0:clean failed: Unable to load the mojo 'clean' in the plugin 'org.apache.maven.plugins:maven-clean-plugin:3.2.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/clean/CleanMojo : Unsupported major.minor version 52.0
导致找了半个小时问题,一直试图看我的maven或者maven插件是不是版本有问题,一直找不到问题。运维给我报错信息太片面了。仔细看上面的报错截图,这个才是完整的错误信息,我发现了cased by这个关键词
这下不就问题找到了,其实发现问题,解决就容易了。
原因:项目环境和运行环境的JDK版本不同导致的
解决办法:重新安装了Linux上的jdk版本(运维把jdk17安装成了jdk1.7)