I have a simple project that need to Run JUnit test and let SonarQube to scan / run the Test of JUnit result with SonarScanner. I put my project at Github here
There are some problems:
- WARN: Class "XXX" is not accessible through the classloader sonar (Reference)
- No jacoco-it.exec and jacoco-ut.exec, only run jacoco.exec at SonarScanner
- Cannot exclude some files when running Test JUnit, because I only want to Run Test in my Service Folder (Reference)
This is my sonar-project.properties :
# Required metadata
sonar.projectKey=com.example:Sample
sonar.projectName=Java :: Example :: SonarQube Scanner
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
sonar.exclusions=src/main/resources/**
#sonar.test.inclusions=src/main/java/com/example/service/**, src/test/java/**
#sonar.test.exclusions=src/main/java/com/example/controller/**
# Encoding of the source files
sonar.sourceEncoding=UTF-8
#Jacoco
sonar.junit.reportsPath=target/surefire-reports
sonar.jacoco.reportPath =target/jacoco.exec
sonar.jacoco.reportMissing.force.zero=true
sonar.java.binaries=target/classes/**
#sonar.java.libraries=libs/**
When I Run Maven Test until build success, It create some files and folders in folder Target.
After that I run my SonarScanner to Scan my project, but I got those problems.
My question:
- How can I run my SonarQube Scanner without any WARN ?
- How to exclude files properly when scanning JUnit result? Because I use the reference settings, and Coverage still scan the files
- How to create jacoco-it.exec and jacoco-ut.exec and run it on SonarScanner?
My project is based on this Reference

sonar-project.propertiesif you are using Maven: please refer to documentation about Analysis using Scanner for Maven - docs.sonarqube.org/display/SCAN/… usage of it should be enough to avoid many configuration headaches, e.g. such as warningClass "XXX" is not accessible.jacoco-ut.execandjacoco-it.execare products of execution ofjacoco-maven-pluginfor unit tests and integration tests respectively. - Godin