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 11 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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clover-plugin</artifactId>
<configuration>
<licenseLocation>/path/to/clover.license</licenseLocation>
<jdk>1.5</jdk>
</configuration>
</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 http://jira.codehaus.org/browse/MJNCSS-16).
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)

I get a SecurityException when I execute the maven plugin

The message of the root exception is

The CGLIB library available in your Maven repository is certainly signed which is not the case on IBIBLIO repository. Perhaps you or your Maven administrator have signed this jar to include it into a Java Web Start application. Unfortunately signing CGLIB jar file breaks Hibernate's use of CGLIB, as it generates proxy classes in the same package (org.sonar.commons.database.* for our context) as the original class. But the original Sonar class is not signed and the new proxy class is, generating a java.lang.SecurityException.

You must also sign Sonar libraries in your Maven repository or used unsigned CGLIB library.

Maven mirrors : the maven plugin fails to resolve org.codehaus.sonar.runtime.* dependencies

Sonar embedds its own maven repository which is used by the Sonar maven plugin to download commercial jdbc driver, pmd or checkstyle extensions, etc. Your maven settings.xml file must contain a section called <mirror> which should look like this :

According to this section, Maven redirect all call to a given repository to this central maven repository, so Sonar maven repository is never touched and Sonar maven plugin fails to resolve org.codehaus.sonar.runtime.* dependencies. Two solutions to solve this issue :

  • If and only if you have Maven version 2.0.9, just change the value of <mirroOf> parameter in your setting.xml file by adding : "*,!sonar"
  • Configure your central maven repository to use the Sonar maven repository (http://sonar:9000:/maven)

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




Error 'Cannot save sonar-pom.xml to ...' when executing the sonar maven plugin

The full log is 

 
 It already appeared on a Windows host that was too much fragmented. Just defragment it to fix the issue.

  • No labels