我的项目太大了,在整个项目上运行Sonar需要花费大量的时间和精力。所以我想知道是否有任何方法可以在单个java文件上运行声纳。
答案 0 :(得分:3)
您可以直接使用包含或排除(或两者)来代替安装此插件。
在已执行的pom.xml中,您可以编写 pathToInclude (在属性部分内),在控制台中,您必须使用 -Dsonar.inclusions = pathToInclude <添加属性/ p>
-Dsonar.inclusions=file:/path_to_my_project/MyProject.java
//only the file above will be analyzed
-Dsonar.exclusions=file:/path_to_my_project_root/another_directory/**/*
//all subfolders and files within "another_directory" are exclued / ignored.
-Dsonar.inclusions=file:/path_to_my_project/another_directory/MyProject.java
-Dsonar.exclusions=file:/path_to_my_project/another_directory/**/*
//all subfolders and files within "another_directory" are exclued / ignored EXCEPT MyProject.java.
答案 1 :(得分:2)
应使用排除或包含模式。有关详细信息,请参阅http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-Patterns。