Im using selfhosted Sonar * Enterprise Edition* Version 9.9.1 (build 69595)
I run sonar inside Azure Devops pipeline using Maven task but I cant see number of Junit test in Overall code tab.
Its a Java maven multi module project. I have pipeline with two templates. In first there is Maven build which also execute Junit test and compute coverage using Jacoco. I store these result to Artifact which I download inside second template where sonar scan is run with skipped tests option to true and I just set paths to those downloaded results. The coverage is working but the number of tests not. I checked the downloaded folder and there are correct result files of Junit test from surefire and failsafe(integration tests) plugins in xml.
Can somebody help?
- task: SonarQubePrepare@4
displayName: 'sonarPrepare'
inputs:
SonarQube: 'SonarQube'
scannerMode: 'Other'
extraProperties: |
sonar.projectName=${{ parameters.myName }}
sonar.projectKey=${{ parameters.sonarProjectKey }}
sonar.login=$(sonarKey)
sonar.java.binaries=.
env:
NODE_EXTRA_CA_CERTS: *******************************************
- task: MavenAuthenticate@0
displayName: 'Maven Authenticate'
inputs:
artifactsFeeds: '${{ parameters.mavenFeed }}'
- task: Maven@3
displayName: 'sonarAnalysis'
inputs:
mavenPomFile: 'pom.xml'
goals: 'sonar:sonar -Dsonar.projectKey=${{ parameters.sonarProjectKey }} -Dsonar.junit.reportPaths=$(System.DefaultWorkingDirectory)/${{ parameters.junitPath }} -Dsonar.projectVersion=${{ parameters.projectVersion }} -Dsonar.projectName=${{ parameters.myName }} -Dsonar.login=$(sonarKey) -Dsonar.host.url=${{ parameters.sonarUrl }} -Dsonar.coverage.jacoco.xmlReportPaths=$(System.DefaultWorkingDirectory)/${{ parameters.pathToPublish }} -Dsonar.coverage.exclusions=${{ parameters.codeCoverageExclude }} sonar:sonar -Dmaven.test.skip=true -e -X'
options: '-Djavax.net.ssl.trustStore=$(JAVA_HOME)/lib/security/cacerts -Djavax.net.ssl.trustStorePassword=changeit'
javaHomeOption: 'JDKVersion'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false