0
votes

I am new to Sonarqube and was trying to integrate SonarQube with TeamCity. I used TeamCity.SonarQube plugin. I added a Build step with Runner Type = "SonarQube Runner" and Sources location=%teamcity.build.checkoutDir% . All the other params are left default. But I got this error while running this step. I am not sure why its looking for sonar.java.binaries whereas my project is in GOLang :I will appreciate if someone can guide me what can be the issue:

[14:57:39]Step 3/3: SonarQube Runner (6s)
[14:57:39][Step 3/3] Starting SQS from /etc/buildAgent1/tools/sonar-qube-scanner.2.4-runner
[14:57:39][Step 3/3] -classpath
[14:57:39][Step 3/3] /etc/buildAgent1/tools/sonar-qube-scanner.2.4-runner/lib/sonar-runner-dist-2.4.jar
[14:57:39][Step 3/3] org.sonar.runner.Main
[14:57:39][Step 3/3] -Dproject.home=.
[14:57:39][Step 3/3] -Dsonar.host.url=https://XXX.XXX
[14:57:39][Step 3/3] -Dsonar.projectKey=XXX
[14:57:39][Step 3/3] -Dsonar.projectName=XXX
[14:57:39][Step 3/3] -Dsonar.projectVersion=389
[14:57:39][Step 3/3] -Dsonar.sources=/data/buildAgent1/work/b67bbc3af5f79b3e
[14:57:39][Step 3/3] -Dsonar.password=*******
[14:57:39][Step 3/3] -Dsonar.login=*******
[14:57:39][Step 3/3] -Dscanner.home=/etc/buildAgent1/tools/sonar-qube-scanner.2.4-runner
[14:57:39][Step 3/3] Starting: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/bin/java -classpath /etc/buildAgent1/tools/sonar-qube-scanner.2.4-runner/lib/sonar-runner-dist-2.4.jar org.sonar.runner.Main -Dproject.home=. -Dsonar.host.url=https://XXX.XX -Dsonar.projectKey=Colony -Dsonar.projectName=Colony -Dsonar.projectVersion=389 -Dsonar.sources=/data/buildAgent1/work/b67bbc3af5f79b3e -Dsonar.password=******* -Dsonar.login=******* -Dscanner.home=/etc/buildAgent1/tools/sonar-qube-scanner.2.4-runner
[14:57:39][Step 3/3] in directory: /data/buildAgent1/work/b67bbc3af5f79b3e
[14:57:39][Step 3/3] SonarQube Runner 2.4
[14:57:39][Step 3/3] Java 1.8.0_161 Oracle Corporation (64-bit)
[14:57:39][Step 3/3] Linux 3.10.0-693.21.1.el7.x86_64 amd64
[14:57:39][Step 3/3] INFO: Runner configuration file: NONE
[14:57:39][Step 3/3] INFO: Project configuration file: NONE
[14:57:39][Step 3/3] INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
[14:57:39][Step 3/3] INFO: Work directory: /data/buildAgent1/work/b67bbc3af5f79b3e/./.sonar
[14:57:39][Step 3/3] INFO: SonarQube Server 7.1.0.11001
[14:57:40][Step 3/3] 14:57:40.140 INFO - Publish mode
[14:57:40][Step 3/3] 14:57:40.358 INFO - Load global settings
[14:57:40][Step 3/3] 14:57:40.534 INFO - Load global settings (done) | time=177ms
[14:57:40][Step 3/3] 14:57:40.543 INFO - Server id: AWO7-uBKeBjyjgchqSN2
[14:57:40][Step 3/3] 14:57:40.557 INFO - User cache: /root/.sonar/cache
[14:57:40][Step 3/3] 14:57:40.844 INFO - Load plugins index
[14:57:40][Step 3/3] 14:57:40.900 INFO - Load plugins index (done) | time=56ms
[14:57:40][Step 3/3] 14:57:40.900 INFO - Load/download plugins
[14:57:40][Step 3/3] 14:57:40.922 INFO - Load/download plugins (done) | time=22ms
[14:57:41][Step 3/3] 14:57:41.591 INFO - Process project properties
[14:57:41][Step 3/3] 14:57:41.625 INFO - Load project repositories
[14:57:41][Step 3/3] 14:57:41.637 INFO - Load project repositories (done) | time=12ms
[14:57:41][Step 3/3] 14:57:41.746 INFO - Load quality profiles
[14:57:41][Step 3/3] 14:57:41.777 INFO - Load quality profiles (done) | time=31ms
[14:57:41][Step 3/3] 14:57:41.815 INFO - Load active rules
[14:57:42][Step 3/3] 14:57:42.318 INFO - Load active rules (done) | time=503ms
[14:57:42][Step 3/3] 14:57:42.321 INFO - Load metrics repository
[14:57:42][Step 3/3] 14:57:42.345 INFO - Load metrics repository (done) | time=24ms
[14:57:42][Step 3/3] 14:57:42.380 INFO - Project key: Colony
[14:57:42][Step 3/3] 14:57:42.380 INFO - Project base dir: /data/buildAgent1/work/b67bbc3af5f79b3e
[14:57:42][Step 3/3] 14:57:42.381 INFO - ------------- Scan Colony
[14:57:42][Step 3/3] 14:57:42.540 INFO - Load server rules
[14:57:42][Step 3/3] 14:57:42.594 INFO - Load server rules (done) | time=54ms
[14:57:42][Step 3/3] 14:57:42.637 INFO - Base dir: /data/buildAgent1/work/b67bbc3af5f79b3e
[14:57:42][Step 3/3] 14:57:42.637 INFO - Working dir: /data/buildAgent1/work/b67bbc3af5f79b3e/.sonar
[14:57:42][Step 3/3] 14:57:42.639 INFO - Source paths: .
[14:57:42][Step 3/3] 14:57:42.639 INFO - Source encoding: UTF-8, default locale: en_US
[14:57:42][Step 3/3] 14:57:42.786 INFO - Index files
[14:57:44][Step 3/3] 14:57:44.024 INFO - 18238 files indexed
[14:57:44][Step 3/3] 14:57:44.025 INFO - Quality profile for go: Sonar way
[14:57:44][Step 3/3] 14:57:44.026 INFO - Quality profile for java: Sonar way
[14:57:44][Step 3/3] 14:57:44.026 INFO - Quality profile for js: Sonar way
[14:57:44][Step 3/3] 14:57:44.026 INFO - Quality profile for py: Sonar way
[14:57:44][Step 3/3] 14:57:44.026 INFO - Quality profile for web: Sonar way
[14:57:44][Step 3/3] 14:57:44.026 INFO - Quality profile for xml: Sonar way
[14:57:45][Step 3/3] 14:57:45.274 INFO - Sensor JavaSquidSensor [java]
[14:57:45][Step 3/3] 14:57:45.564 INFO - Configured Java source version (sonar.java.source): none
[14:57:45][Step 3/3] 14:57:45.576 INFO - JavaClasspath initialization
[14:57:45][Step 3/3] INFO: ------------------------------------------------------------------------
[14:57:45][Step 3/3] INFO: EXECUTION FAILURE
[14:57:45][Step 3/3] INFO: ------------------------------------------------------------------------
[14:57:45][Step 3/3] Total time: 6.278s
[14:57:45][Step 3/3] ERROR: Error during Sonar runner execution
[14:57:45][Step 3/3] ERROR: Unable to execute Sonar
[14:57:45][Step 3/3] ERROR: Caused by: Please provide compiled classes of your project with sonar.java.binaries property
[14:57:45][Step 3/3] ERROR:
[14:57:45][Step 3/3] ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
[14:57:45][Step 3/3] Final Memory: 18M/859M
[14:57:45][Step 3/3] ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
[14:57:45][Step 3/3] INFO: ------------------------------------------------------------------------
[14:57:45][Step 3/3] Process exited with code 1
[14:57:45][Step 3/3] Process exited with code 1
[14:57:45][Step 3/3] Step SonarQube Runner failed
1
SonarQube and the analyser needs a Java-runtime. Did you install that? - Jeroen Heier
yes, I installed openjdk version "1.8.0_171". I guess SonarQube always expects the value for java class files location to be configured even if the Source code is in Python or in GoLang - Rajeev Ghosh
Do you have any .java files in your project? - G. Ann - SonarSource Team
no, all the files are .go - Rajeev Ghosh

1 Answers

2
votes

The problem is fixed now. it looks like the plugin expects some values for the field "Binaries Location". when I set this filed with a folder name that exists in the Source directory(it does not matters if that directory really contains any java class files or not), it fixed the problem and the SonarQube analysis worked fine.