SonarQube Exclude a directory

2019-03-09 14:48发布

I am trying to exclude a directory from being analyzed by Sonar. I have the following properties defined in my sonar-project.properties file:

sonar.sources=src/java
sonar.exclusions=src/java/test/****/*.java

The directory structure I have is:

src/java/dig
src/java/test/dig

When I run the sonar-runner I get the following info:

 INFO  - Excluded sources:
 INFO  -   src/java/test/**/*.java
 INFO  - Excluded tests:
 INFO  -   **/package-info.java

But when I check the result of the analysis all the packages inside the test directory are still there.

I just need to tell Sonar to not analyze the test directory and any packages inside it.

8条回答
SAY GOODBYE
2楼-- · 2019-03-09 15:32

what version of sonar are you using? There is one option called "sonar.skippedModules=yourmodulename".

This will skip the whole module. So be aware of it.

查看更多
ら.Afraid
3楼-- · 2019-03-09 15:36

Easiest way is to go to the server URL after starting the server(localhost:8080) then login as admin,Go to settings>Exclusions> Source File Exclusions- Add your packages here. Restart the server.

查看更多
登录 后发表回答