I am running sonar from Jenkins. I want to exclude some java files in the sonar report. Is that possible through Jenkins? If yes, how can I do that?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Assuming you are using jenkins sonar plugin, refer to this documentation on how to configure the plugin to specify additional parameters which allow files to be excluded from analysis.
回答2:
Just pass the "sonar.exclusions" property to your build (for instance using a JVM argument "-Dsonar.exclusions=**/Foo.java").
回答3:
- Go to sonar section of your jenkins job.
- Click on advanced.
- In Additional properties put or add:
-Dsonar.exclusions=com/company/packageA/generated/**/*.java,com/company/packageB/generated/**/*.java
- Save changes.
Notice how multiple packages can be specified using commas.