SONAR - 如何排除根据&QUOT定义的包; sonar.test" [英] SONAR - How to exclude packages that is defined under "sonar.test"

查看:347
本文介绍了SONAR - 如何排除根据&QUOT定义的包; 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".

我的文件夹结构:

/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/**/*" />

所以,我想只包括搜索包。在code以上的方式,它会导致SONAR只分析我的搜索包工程。该软件包可以在SONAR组件选项卡中可以看出。不幸的是,除了搜索部分,我还可以看到UTIL和池组件。我做了一些测试,并确定这两种成分(utils的和池)是sonar.tests特性的结果。刚一说明虽然,尽管UTIL和池的组成部分显示出来,SONAR显示下他们两个零文件。所以回到我的问题,反正是有,我可以做从下的组件显示出来排除UTIL和统筹?也许使用性质(即声纳测试排除)?

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)?

顺便说一句,我使用SONAR 2.11和Red Hat Linux下运行。我使用声纳的任务1.2。

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

任何帮助,欢迎和AP preciated!谢谢!

Any help is welcomed and appreciated! Thanks!

推荐答案

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

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

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

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