SONAR - 如何排除在“sonar.test”下定义的包 [英] SONAR - How to exclude packages that is defined under "sonar.test"

查看:2777
本文介绍了SONAR - 如何排除在“sonar.test”下定义的包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JAVA中有一个项目,我使用声纳进行分析。我有一些java包都在源文件夹下。我也有一些测试文件,我有在不同的文件夹。现在,在声纳,我组织我的项目在不同的结构,即一个项目搜索,我只想包括搜索包。这些排除使用sonar.exclusion属性很容易实现。我的问题,但是,测试是怎么样?如何排除一些包?因为从我的测试,即使我的源和测试文件夹使用相同的结构,当我指定sonar.exclusions时,测试包不会自动排除。

I have a projects in JAVA that I analyze using sonar. Some of the java packages that I have are all under source folder. I also have some test file that I have under a different folders. Now, in Sonar, I organize my projects under a different structure, i.e. for a project "search", I only wants to include "search" package. These exclusion is quite easy to accomplished using sonar.exclusion properties. My question, though, is how about the test? how can I exclude some of the packages? Because from my testing, even though my source and test folder are using the same structure, the test packages are not automatically excluded when I specified "sonar.exclusions".

my文件夹结构:

/src/com/domain/
   -- search/
   -- utils/
   -- pooling/
   -- category/

/test/src/com/domain/
   -- utils/
   -- pooling/

声纳属性:

<property name="sonar.sources" value="${path}/src" />
<property name="sonar.tests" value="${path}/test/src" />
<property name="sonar.exclusions" value="com/domain/utils/**/*,com/domain/pooling/**/*,com/domain/category/**/*" />

所以,我试图只包括搜索包。上面的代码工作方式使得SONAR只分析我的搜索包。此软件包可以在SONAR的组件选项卡中找到。不幸的是,除了搜索组件,我还可以看到util和pooling组件。我做了一些测试,并确定这两个组件(utils和pooling)是sonar.tests属性的结果。只是一个注意,虽然util和pooling显示在组件中,SONAR在它们两个下显示零文件。所以回到我的问题,有没有反正我可以排除util和pooling显示在组件下?也许使用属性(即声纳测试排除)?

So, I am trying to only include the "search" package. The code above works in a way that it causes SONAR to only analyze my "search" package. This package can be seen in the SONAR "Components" tab. Unfortunately, in addition to the "search" component, I can also see the "util" and "pooling" components. I have done some testing and certain that these two components (utils and pooling) are the result of "sonar.tests" properties. Just a note though, even though "util" and "pooling" shows up in components, SONAR shows zero files under both of them. So going back to my question, is there anyway that I can do to exclude "util" and "pooling" from showing up under "Components"? Maybe using properties (i.e. sonar test exclusions)?

Btw,我使用SONAR 2.11并运行在Red Hat Linux下。我使用SONAR-TASK 1.2。

Btw, I am using SONAR 2.11 and is running under Red Hat linux. I'm using SONAR-TASK 1.2.

任何帮助,欢迎和赞赏!谢谢!

Any help is welcomed and appreciated! Thanks!

推荐答案

您可以直接在声纳中为项目的配置定义排除。

You can define exclusions in the Configurations for the project directly in sonar.

这篇关于SONAR - 如何排除在“sonar.test”下定义的包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆