ant sonar merge multiple reports into one - java

I am using ant sonar on my project. There are multiple modules in my project, is it possible to merge the reports of all the projects into one so that it appears as a single project on Sonar Qube console?

Yes there is a way to do this, but it requires purchase of the commercial views plugin.

Related

How to run a local Sonar check before merging to a GIT repository?

In my current project, whenever a GIT merge of a feature branch is performed to master, a remote Sonar analysis is performed with SonarQube.
I heard from my colleagues that they tried the Sonar plugin for Intellij and it passed their code, however the remote Sonar configuration failed the branch build. This meant creating new GIT branches with Sonar fixes.
Is there any way to configure and run a server-like Sonar check on the local machine before pushing and merging, so that issues are addressed quickly and no new branches are needed?
You can check out git (web) hooks, depending on your overall set up.

Unknown error - sonar eclipse plugin

I have installed the sonar eclipse plugin in eclipse Juno. I put the groupid and the artifactid into the proper lines, however I get an error:
Unknown exception
How to configure the sonar plugin properly in eclipse?
You need to install Sonar on a server (or run it on your machine for testing). Then you need to configure it in the Eclipse properties and choose it from the drop-down in the associate with sonar dialog (unless it runs on your machine, in which case it is already available from the drop down).
Before you can associate a project with sonar, you need to run the sonar analysis on that project (usually using maven). Take a look at the sonar documentation to get more information.

Using the sonar plugin with eclipse

I'm trying to use Sonar to analyse my projects in Eclipse. I am currently using Maven in eclipse. I installed the Sonar Eclipse plugin as described in this link.
But when I try and associate my project with Sonar, I get an error saying:
project with key not found on server.
Am I missing some steps? I started the Sonar Server before connecting to eclipse. But nothing works.
I even tried following this article (Sonar plugin Eclipse) but to no avail.
Please help..The Sonar documentation is not descriptive at all making it very hard for beginners like me to understand.
You can not associate your project in Eclipse if you haven't first analysed it with Sonar (by running "mvn sonar:sonar" on your project).
Once your project has been succesfully analysed and that you can browse it in the Web UI (http://localhost:9000 by default), then you can try to associate your project within Eclipse and this will work.

Warning developers about out of date dependencies

Is there a way in Maven, Hudson, or Sonar to warn on the inclusion of certain out of date artifacts in a build.
For example, consider having a number of internal business jars. Some versions of these jars can go through an end-of-life phase. During this time, it would be nice if any builds that occurred would issue some sort warning and direct the user to some documentation about the issue.
To be clear, builds shouldn't fail. Also, we only want to apply this logic to a certain set of artifacts, not everything.
Using the maven dependency plugin you can run this
mvn versions:display-dependency-updates
This will display a list of all artifacts that have newer versions available in the repository. Just have the devs run that every so often and update accordingly.
You could try using the enforcer plugin to specify the dependencies which are no longer allowed.
Plugin has goals to either enforce the rules (thereby failing your build) or print a violation report.
Update
I use the dependencies report in Sonar to lookup cross project usage of obsolete libraries.
I know you're also using Sonar, but just in case here's an example:
Usage of log4j, version 1.2.9.
(This information is coming from the Maven POM of each project analysed by Sonar).
I think what you're really looking for, does not currently exist.... A plugin that works like the standard Maven enforcer plugin, but is configured from and raises violations in Sonar!
Why don't you post this as an idea on the Sonar JIRA?

Sonar plugin Eclipse

Can I use Sonar plugin without others installations of Sonar ? I'm trying to use following the steps of sonar doc but it don't work. When I try to associate my projects the message "IDgroup empty" appears, and I can't connect when I try 'test connection'. Someone knows some better tutorial , or more specific? Thanks
You have to be running Sonar somewhere, localhost:9000 is fine. Then you have to do a build of this project using that Sonar. If you are using Maven, right click on the project -> Run As -> Maven build, and put in sonar:sonar as the Goal. This can also be done using Ant instead, but you will need a sonar target in your build.xml. Then when you do the "Associate with Sonar" dialog, if GroupId and ArtifactId are empty, type in the correct values in those columns.
To use the plugin you need a sonar sever somewhere. Do not hesitate to install the sonar server on your local machine if you do not have a central installation. It is very simple to setup the server for local testing/usage.
You need a sonar installation. Without it you won't be able to use the plugin.
The Sonar user guide should clarify this question. It is not possible to use the plugin without an running sonar instance anywhere. You need to install it somewhere an analyse the project once with the sonar runner, ant or maven.
After this procedure you are able to analyse your project locally. The reason for this precondition is the central configuration of Sonar.
Sonar User Guide (Configuring Sonar in Eclipse)

Categories

Resources