sona 版本 -》 sonarQube 9.9LTS ( docker ) 服务器 -》 CentOS7
我今天在使用 docker 部署好 server 后,生成令牌准备推送项目到 sonar 上遇到了问题
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar (default-cli) on project api-web: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/org/sonarsource/scanner/maven/sonar-maven-plugin/3.11.0.3922/sonar-maven-plugin-3.11.0.3922.jar
[ERROR] urls[1] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/org/codehaus/plexus/plexus-sec-dispatcher/2.0/plexus-sec-dispatcher-2.0.jar
[ERROR] urls[2] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/org/codehaus/plexus/plexus-utils/3.4.1/plexus-utils-3.4.1.jar
[ERROR] urls[3] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/org/codehaus/plexus/plexus-cipher/2.0/plexus-cipher-2.0.jar
[ERROR] urls[4] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/org/sonarsource/scanner/api/sonar-scanner-api/2.16.3.1081/sonar-scanner-api-2.16.3.1081.jar
[ERROR] urls[5] = file:/D:/devSoftWare/apache-maven-3.8.6/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.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.apache.org/confluence/display/MAVEN/PluginContainerException
问题上显示的因为 java 版本的问题,项目使用的 java8 ,而报错让用 java11
但是我通过查阅得知, 这个可以使用低版本的 sonar scanner 插件解决 于是我引入了 报错中的 3.11
如果不指定版本默认会使用 4.x 版本的
这里有所有扫描器的版本 https://docs.sonarsource.com/sonarqube-server/9.9/analyzing-source-code/scanners/sonarscanner-for-maven/
我切换了很多版本,到目前为止一直是 java 版本的问题不知道应该如何处理了
这里还有一种方式,不通过 maven 的方式来使用扫描器,使用官方提供的 linux/win/mac 的压缩程序类似于添加额外的工具来执行扫描,目前这个办法看起来是不会限制的(还没尝试)
我这里更倾向于使用 maven ,如果实在不行我就放弃了 佬,快来帮帮我
1
xuzhzzz 19 天前
用 sonarqube 7.8
|