Excluding java files in sonar report through Jenki

2019-06-19 08:03发布

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?

3条回答
相关推荐>>
2楼-- · 2019-06-19 08:14

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.

查看更多
萌系小妹纸
3楼-- · 2019-06-19 08:15
  1. Go to sonar section of your jenkins job.
  2. Click on advanced.
  3. In Additional properties put or add:
    -Dsonar.exclusions=com/company/packageA/generated/**/*.java,com/company/packageB/generated/**/*.java
  4. Save changes.

Notice how multiple packages can be specified using commas.

查看更多
甜甜的少女心
4楼-- · 2019-06-19 08:32

Just pass the "sonar.exclusions" property to your build (for instance using a JVM argument "-Dsonar.exclusions=**/Foo.java").

查看更多
登录 后发表回答