Command to publish jacoco report to SonarQube

I am very new to Jacoco and SonarQube. I’ve SonarQube 6.0 installed and jacoco-0.7.5.201505241946 version.

I’ve Jacoco.exec is created and now I want to publish code coverage to SonarQube. We don’t have Maven supported in our project hence trying with command line like -

/home/oracle/jenkins/tools/hudson.plugins.sonar.SonarRunnerInstallation/Sonar6/bin/sonar-scanner -e -Dsonar.web.javaOpts=-Xmx2G -Dsonar.host.url=http://localhost:9000/ -Dsonar.projectVerion=BI7_9_b -Dsonar.projectKey=BI7_9_b -Dsonar.projectName=BI7_9_b -Dsonar.analysis.mode=publish -Dsonar.issuesReport.html.enable=true -Dsonar.issuesReport.console.enable=true -Dsonar.jacoco.reportPaths=/home/oracle/Jacoco/jacoco51.exec

But this command gives error -

You must define the following mandatory properties for ‘BI7_9_b’: sonar.projectVersion, sonar.sources

What could be value of sonar.sources here? Also could you please help me with minimal command to publish report? If documentation, please point it to me.

Well, you have some typos. :slight_smile:

-Dsonar.projectVerion

And in such an old version of SonarQube, you’ll need to declare sonar.sources (even if that is just sonar.sources=..

This is a very old version of SonarQube. You should upgrade to v6.7 LTS and then v7.9 LTS (currently the minimum support version of SonarQube). Beyond some basic pointers, we don’t provide support for such old versions as v6.0

Thanks Colin for reply and I could proceed now! I corrected spelling mistake and used sonar.sources=. and my jacoco51.exec has size of 381KB still I could not see any code coverage details on SonarQube.

You’re right. My SonarQube version is old one but unfortunately, our organization is still using it.

I would recommend making sure your organisation is aware that your SonarQube version became EOL in October 2016 (when SonarQube v6.1 was released). Non-LTS versions become EOL as soon as a newer version is released.

Maybe another community member will have some ideas. :slight_smile: