maven sonar plugin use checkstyle rules from pom - maven

Is there a way to get sonar to use the checkstyle configuration from my pom file? I have the maven checkstyle plugin setup, and I have the maven sonar plugin (version 2.7) setup, but sonar seems to use its default checkstyle configuration. I know I can create a new quality profile and upload the checkstyle file, but I would think that the maven plugin should use the one from the pom. Any help here is appreciated.
thanks,
Jeff

It used to be possible from Sonar 1.11 to Sonar 2.2 by using a parameter sonar.reuseExistingRulesConfiguration. It was removed from Sonar 2.3.
See SONAR-583
See SONAR-1706

Related

Unable to register extension org.sonar.plugins.cobertura.CoberturaSensor from plugin 'cobertura'

Since I updated my sonarqube server to 6.1 I'm getting this error in my gradle project.
I'm using sonar plugin latest version (2.2)
classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.2")
anyone knows how to solve it?
Thanks!
I resolved this problem by delete the cobertura jar file in the plugins folder. It seems sonarqube 6.1 does not support cobertura any more. because after i delete the file i can't find cobertura in the sonar plugin management page.

what is dependency for Sonar-plugins in POM

We have upgraded SonarQube from version 3.7.2 to 4.5.5. We are using maven to
build and deployment.
There are some plugins need to be updated. But, I am not sure whether, I am not able to find the exact GAV parameter for them or to find latest version using POM.
e.g Build-stability-plugin; I am not able to find version 1.3 for this plugin on maven repository.
Any kind of help will be appreciated
You mix Maven plugins and SonarQube plugins. The latter doesn't need to be deployed in Maven repository nor to be defined in project poms.

resource is not indexed in grails project and sonar

I want to use sonar to monitor the junit test code coverage for a grails project. firstly I use grails code coverage plugin to generate the coverage.xml and configure sonar.groovy.cobertura.reportPath property, but there is no data in junit part. So I change the sonar.sources in the pom.xml from grails-app to grails-app/controllers,grails-app/services,grails-app/domain. then the junit code coverage appears but the console shows resource is not index.and the issues part in sonar dashboard becomes 0. How can i solve that? thank you very much.
sonarqube 4.5.1
Groovy sonar plugin 1.0.1
maven 3.2.5
the pom configuration is below:
<sonar.language>grvy</sonar.language>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.surefire.reportsPath>test/reports</sonar.surefire.reportsPath>
<sonar.groovy.cobertura.reportPath>test/reports/cobertura/coverage.xml</sonar.groovy.cobertura.reportPath>
<!--sonar.groovy.codenarc.reportPath>test/CodeNarcReport.xml</sonar.groovy.codenarc.reportPath-->
<sonar.sources>src/groovy,src/java,grails-app/controllers,grails-app/services,grails-app/domain</sonar.sources>
BR,
victor
It seems that your problem is related to the following issue: http://jira.codehaus.org/browse/SONARGROOV-8
Note that the ticket has been resolved and the fix will be part of version 1.1 of the plugin (requires SQ 4.5.2).
As the plugin has not yet been released, you may want to test the snapshot. Please refer to this thread: http://sonarqube.15.x6.nabble.com/VOTE-Groovy-Plugin-version-1-1-td5033128.html

How to configure findbugs when using sonar with maven

I'm calling sonar from maven:
mvn clean install sonar:sonar
How can I configure the findbugs rules?
Do I have to configure the rules in maven as suggested in Import FindBugs configuration from Sonar to Maven?
Where can I find a documenentation how to write the configuration file?
Is the configuration in sonar still relevant?
The documentation doesn't help.
How can I configure the findbugs rules?
Use the SonarQube web GUI. Click on "Quality Profiles" in the black area at the top, then choose "Java". The Maven plugin will download your definitions from there and use them.
Do I have to configure the rules in maven as suggested in Import FindBugs configuration from Sonar to Maven?
Nope. Configure them only in SonarQube, and you're all set.
Where can I find a documenentation how to write the configuration file?
That would be the FindBugs docs. But you don't need to do that if you're using SonarQube.
Is the configuration in sonar still relevant? The documentation doesn't help.
Yes it is relevant. The SonarQube documentation is generally not very helpful, but configuring rules is quite straightforward using the GUI. You should have a good chance even without documentation.

How to configure/use CheckStyle in Hudson/Jenkins?

I want to learn how to use CheckStyle.
I am doing static code analysis in Hudson, as first part, I installed Static Analyser and CheckStyle plugins in Hudson. But I am not able to find out how to use it in official Hudson checkstyple page also.
official page : http://wiki.hudson-ci.org/display/HUDSON/Checkstyle+Plugin
I saw some documents in Maven checkstyle plugin that we have to mention some configuration in pom file and run the targets.
Then, I got doubt, if I am doing with Maven, why we need the CheckStyle plugin install in hudson?
Is it possible to configure CheckStyle in Hudson job for a Java project instead of changing in pom or not? It here is both ways, then which one is better?
Do you have the steps to configure CheckStyle plugin in Hudson?
If you've installed the plugin in Jenkins/Hudson, you should now be able to add the checkstyle goal to your project/job.
In the goals section of your Jenkins Maven job, add "checkstyle:checkstyle" to enable the checkstyle plugin to analyse your project.

Resources