When I set “sonar.exclusions” and “sonar.test.inclusions”, the unit test is “-”, not a number.
When I delete this two properties,the scan will terminate with an error:xxxxTest.java can’t be indexed twice.
But coverage is right. I do not know why?
Someone help me. Thanks a lot!!
Combining inclusions and exclusions can be tricky. Before we get into that though, how are you analyzing? You’re building with Maven, but You’ve given a list of properties as though from a sonar-properties.project file (which is not picked up by Maven analysis).
If the properties you’re showing are indeed the ones used, then by setting sonar.sources to $WORKSPACE you’ve identified your tests as “code” files. But then Maven would know that they’re actually tests and include them in the list of tests => double counting/indexing.
But let’s start with your actual analysis command, please.
Thank you for your reply!
I use Jenkins + Jenkins SonarQubeScanner plugin + Jenkins Maven plguin to build the code scanning task. The build steps in Jenkins are as follows
Pull the code first
Then add “Call Maven Top Level Target” and configure the above mvn command.
Finally, add “Execute SonarQube Scanner” and configure the above Analysis Properties.