Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

How to manage the measures of multiple SCM branches separately for my project ?

Add the following maven property to your pom.xml :

I get a 'java.lang.OutOfMemoryError : Java heap space' when I execute the maven plugin

Increase the maven available memory by setting set MAVEN_OPTS=-Xmx512m on windows or export MAVEN_OPTS=-Xmx512m on *nix boxes.

I get a 'java.lang.OutOfMemoryError : PermGen space' when I execute the maven plugin

Increase the maven available perm gen space memory by setting set MAVEN_OPTS=-XX:MaxPermSize=256m on windows or export MAVEN_OPTS=-XX:MaxPermSize=256m on *nix boxes.

How can I use Clover instead of Cobertura for code coverage measures ?

Just copy your Clover license file to the root directory of each module. The sonar maven plugin automatically detects its presence then executes Clover. Example on the sonar project itself (see clover.license file)

Sonar refuses to connect to MySql on my Linux distribution

On some Linux distributions, MySql is configured by default to listen to request via an Unix socket file, which is unfortunatly not compatible with Sonar (TCP/IP required).
To fix this issue edit "/etc/my.conf" and make sure that 'skip-networking' is commented to enable TCP/IP.

I have a code coverage of 0% with clover

Clover maven plugin does not always plays nice with "provided" dependencies scope, this issues creates a zero code coverage value under sonar.
If you have such issue, to check that everything is well configured, add in you pom :<plugin>
and launch mvn clean clover:instrument clover:clover.
If the clover compilation is failing, check your pom and add missing dependencies until it pass. This should fix the zero code coverage issue.

Is it possible to add, remove, or customize a report plugin used by Sonar ?

No, it's not yet possible.

Does Sonar work for maven multi-modules projects ?

Yes. More information on the Maven site.

I would like to be able to hide/ignore a maven subprojet in sonar site.

You can't do that.
A workaround is to build the modules to ignore within a profile. Example :

These 2 modules will not be processed by sonar. To build, you must execute "mvn install -Pextra-modules".

I get a ParseException when using @SuppressWarning tag in my source code.

This is unfortunatly a JavaNCSS bug (see
We don't know if it will be fixed quickly. So we're looking for another plugin to calculate such basic measures (lines of code, complexity, nb of classes/methods). Do not hesitate to tell us if you know one ;o)

The maven plugin fails with the error 'Embedded error: Error occured during file http://localhost:9000/rules_config/checkstyle.xml download'

The problem is just that you do not use the same versions between the server and the maven plugin. The server is 1.1 whereas you use the deprecated maven plugin ch.hortis.sonar:sonar-maven-plugin. The goal to execute is :mvn org.codehaus.sonar:sonar-maven-plugin:1.1:sonar

How the database size evolves over time ?

There are globally two types of data : high-level measures for time machine (all measures at project level, displayed on the dashboard) and low-level measures displayed on breakdown pages (measures and rule violations at class level). Those last ones are automatically purged to keep only last day data.

Here are some statistics of our MySQL5 database for 80 projects (various size, from simple libraries like commons-lang to big enterprise tools like cocoon or jackrabbit) :
- high level measures : 200 Mo / month
- low level measures : 1'800Mo (constant in time), match 162'000 java files.

Those values includes data and index sizes.

How is calculated the Rules Compliance indicator ?

LOC = Lines Of Codes

rules_compliance_index = 1 - (total_violation_nb * 3) / LOC
efficiency_index = 1 - (efficiency_violation_nb * 3) / LOC
reliability_index = 1 - (reliability_violation_nb * 3) / LOC

with total_violation_nbre = efficiency_violation_nb + reliability_violation_nb + maintenability_violation_nb + usability_violation_nb + portability_violation_nb

Of course with that kind of calculations :

rules_compliance_index is not equal to (efficiency_index + reliability_index + ... ) / 5

and that's why you are a bit confused.

I suggest to do the following changes :

efficiency_index = 1 - (efficiency_violation_nb * 3 * 5) / LOC
reliability_index = 1 - (reliability_violation_nb * 3 * 5) / LOC
(3*5 is just a accelerator factor)

and with rules_compliance_index = (efficiency_index + reliability_index + ... ) / 5

If someone has a best idea, feel free to challenge us on this discussion ;o)

How to plug Sonar to an Apache server ?

There are several ways to plugin a web application to an Apache server. It is not specific to Sonar. You can use the mod_jk connector if Sonar is deployed on Tomcat. The mod_proxy can also be used. Here is an example of virtual host (sonar listens on the 9000 port) :

  • No labels