Question

My project is too big, and running Sonar on the entire project is taking lots of time and memory. So I want to know if there is any means to run sonar on a single java file.

Was it helpful?

Solution

Instead of installing this plugin you can alos use directly inclusions or exclusion (or both).

Within a executed pom.xml you can write pathToInclude (within the property section) and within the console you must add a property with -Dsonar.inclusions=pathToInclude

-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.

OTHER TIPS

Exclusion or inclusion patterns should be used. See http://docs.codehaus.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-Patterns for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top