错误如下:
Starting a Gradle Daemon, 1 incompatible and 3 stopped Daemons could not be reused, use --status for details
> Task :bootBuildInfo
Execution optimizations have been disabled for task ':bootBuildInfo' to ensure correctness due to the following reasons:
- Gradle detected a problem with the following location: 'G:\IdeaProjects\xxxxxxxx\build\resources\main\META-INF'. Reason: Task ':compileJava' uses this output of task ':bootBuildInfo' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.1/userguide/validation_problems.html#implicit_dependency for more details about this problem.
> Task :sonarqube FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':sonarqube'.
> 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
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
原因:
由于 SonarQube 9.0 必须使用 JDK11 进行分析。这是 9.0 中的重大更改之一,请参阅官方文档
解决方案
修改JDK版本大于11 + ,或者临时设置 JAVA_HOME 得以解决
set JAVA_HOME = /usr/local/jdk11
./gradlew sonarqube -Dsonar.projectKey=xxxxx -Dsonar.host.url=http://sonarqube.xxxxxx.com -Dsonar.login=e965d7087594566b01b2a43ab5200c2c2ed0a070