Sonar plugin Eclipse - java

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)

Related

Analyzing ant project with sonar ant task and jenkins

I am using the sonar ant task jar for sonar analysis so I setup it in the project-properties.xml and create an Ant build step in jenkins. When I build the job, the analysis works fine and I am able to see the results in the sonarqube server, but in jenkins no link to SonarQube is visible.
Do I really need to install the SonarQube plugin for the link to be visible for the job?
See also how to publish sonar result in jenkins server, or do we have sonar-report jenkins plugin
Normally you let SonarQube handle the code analysis on it's own and not by the Ant task (in the Jenkins job).
The Jenkins plug-in is there to trigger Sonar, to get latest sources (from the SCM) and run the analysis.
The results, are then made available on Sonar, but the Jenkins project, will provide a link to the results.
Workaround
There is (for as far as I know) no way to add a link, to an external generated report. What could be done, is add a simple HTML page, with a link to the Sonar server, to the project. And publish that simple HTML page, with the HTML Publisher Plugin.

ant sonar merge multiple reports into one

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.

Is it possible to run mvn sonar:sonar for maven project in other application?

I am able to add my maven java web project(say example:ApplicationBuild) to sonar running on my local machine. Now I want to write a small new java application which should add "Application Build" to sonar instead adding same from command line using mvn sonar:sonar. Is it possible? I searched but i din't get solution for this.
Yes you can.
it check whether your local sonar instance is localhost:9000/

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.

Categories

Resources