Reputation: 21
I need to build a Jenkins job that takes an action like move files between folders based on code coverage values from Jacoco/SonarQube. I need some guidance on how Jenkins can get the coverage from jacoco-it.exec or SonarQube coverage values.
Thanks, Satya
Upvotes: 0
Views: 8862
Reputation: 143
You need to first install "SonarQube Scanner Plugin" and setup SonarQube server configuration in Global Tool settings of jenkins. Then In job Configuration-> Build -> SonarQube Scanner mention following properties related to jacoco along with sonar project related properties.
`sonar.host.url=http://xxx:9000/sonar
sonar.projectKey=xxx
sonar.projectName=xxx
sonar.projectVersion=1.0.0
sonar.sources=xxx/src/main
sonar.sourceEncoding=UTF-8
sonar.language=java
sonar.java.binaries=xxx/target/classes
sonar.tests=xxx/src/test
sonar.junit.reportsPath=xxx/target/surefire-reports
sonar.surefire.reportsPath=xxx/target/surefire-reports
sonar.jacoco.reportPath=xxx/target/jacoco-it.exec
sonar.binaries=xxx/target/classes
sonar.java.coveragePlugin=jacoco
sonar.verbose=true`
Upvotes: 2
Reputation: 1843
I'm not having any idea about the Jacoco but, I can help you with Sonarqube.
First, you have to install the Sonarqube in the machine where you are running your Jenkins. It's lightweight, you can see the details here on how to instal it on your machine: https://docs.sonarqube.org/display/SONAR/Get+Started+in+Two+Minutes
Secondly, On jenkins You have to have the plugins and set it up with server details and all which you can find in this detailed documentaion from Sonarqube: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins
Let me know if you need any help.
Upvotes: 0