Jenkins集成sonarqube报错
报错1
SONAR ANALYSIS FAILED ------------------------------------------------------------------------ FATAL: SonarQube Scanner executable was not found for sonarscanner ERROR: SonarQube Scanner executable was not found for sonarscanner Finished: FAILURE
说明:指定的下载没有生效 需要手动下载并指定好路径
下载 SonarQube Scanner
wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747.zip unzip sonar-scanner-cli-4.7.0.2747.zip mv sonar-scanner-4.7.0.2747 /opt
指定 SonarQube Scanner
如果没有路径这个选项 是因为勾选了下面的自动安装 把他取消
报错2
ERROR: Error during SonarScanner execution org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property. at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75) at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317) at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:164) at org.sonar.java.JavaSquid.<init>(JavaSquid.java:87) at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:104)
解决办法:需要添加sonar.java.binaries配置,即:
sonar.java.binaries=./target/classes
需要找到项目的 /target/classes 路径
可以使用 find . -name target 进行查找 每个人的路径都不相同
然后在 Jenkins 中配置
报错3
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging. WARN: Unable to locate 'report-task.txt' in the workspace. Did the SonarScanner succeed? ERROR: SonarQube scanner exited with non-zero code: 1
解决方法:配置一下 sonarqube 的 scm 和 svn