How to configure sonar.junit.reportPaths
Asked Answered
I

0

12

I have tried severally to configure this sonarqube property sonar.junit.reportPaths within Gradle but still get the same error message.
Gradle version -> 6.7.1
SonarQube Server version -> 8.9 (docker image)
Java version -> openjdk 11.0.2
Intellij version -> 2021.1.2
My Sonarqube Gradle configuration is as below:

plugins {
    id 'java'
    id 'jacoco'
    id "org.sonarqube" version "3.3"
    id 'org.jetbrains.kotlin.jvm' version '1.5.20'
}

sonarqube {
    properties {
        property 'sonar.projectName', 'Snippets of Java code'
        property 'sonar.junit.reportPaths', 'build/test-results/test'
        property 'sonar.coverage.jacoco.xmlReportPaths', 'build/reports/test/jacocoTestReport.xml'
        property 'sonar.inclusions', '*.java,*.kt'
    }
}

jacocoTestReport {
    reports {
        xml.required = true
        csv.required = false
    }
}

I still get the message below:

Resource not found: com.sammy.service.JavaFareTest under the directory /Users/samuelifere/IdeaProjects/codingChallenges while reading test reports. Please, make sure your "sonar.junit.reportPaths" property is configured properly
Resource not found: com.sammy.model.JavaCardTest under the directory /Users/samuelifere/IdeaProjects/codingChallenges while reading test reports. Please, make sure your "sonar.junit.reportPaths" property is configured properly

I read several stackoverflow pages such as these: 1, 2 but still didn't help in resolving my issue. Any help would be much appreciated, so it can properly find the resources.

The command I use to run to run this through Gradle is:

./gradlew clean build jacocoTestReport sonarqube
Incompetent answered 26/6, 2021 at 13:52 Comment(14)
Why are you trying to configure the property? The default value doesn't work correctly? The same question apply to sonar.coverage.jacoco.xmlReportPaths?Landscape
The default for this property sonar.junit.reportPaths doesn't work. The other one for the jacoco xml path isn't needed. Issue still remains regardless of whether that property is configured or not, so it seems to be ignored somehow.Incompetent
Same issue here. Did you find a solution? I tried a few things with no resultLilas
Same issue. Any resolution?Grote
I've still being unable to find a suitable solution as it is actually. Sorry guys, still searching.Incompetent
Any update @Sammy65. I am still Facing the same issueAril
Same issue for gradle, worked for kotlinDiamagnet
I still haven't found a solution for this people. @ValentynKolesnikov, are you saying it'll work in a build.gradle.kts?Incompetent
The issue was resolved a few days ago without any modifications to the application's codeDiamagnet
@ValentynKolesnikov Oh great! How was it sorted then? Was it a Gradle issue which got resolved in a new version?Incompetent
I believe this is connected to the responses generated by the server.Diamagnet
The problem has resurfacedDiamagnet
Just upgraded our project to Gradle 8.3 and Java 17. Now I'm also finding this error when trying to run sonar.Built
Any update on this error.Aril

© 2022 - 2024 — McMap. All rights reserved.