don't see result on sonar server web page by analyzing eclipse plugin - maven

im trying to analyze a maven project via sonar on eclipse.Everything works fine,but I don't see anything on sonar server web interface.
I checked window>preferences>sonar>servers and it seems
localhost:9000,
test connection:Successfully connected!
but why doesnt seem result on web interface?

As you can read it in the documentation of Sonar Eclipse, you must first make sure that your project has previously been analysed on Sonar (outside of Eclipse).

Related

Configure Bamboo to call SonarQube to analyze Servlet Based Java Application

We have one old Servlet based application and we use bamboo for continuous integration and build. Is there any way to call sonarqube to analyze the code. There is one Sonar For Bamboo plug in but that's not for free.
You don't need it. The plugin just let you configure the Sonar steps in a more friendly way and put the configurations about the SonarQube server in the plugin configuration.
What you can do is to install in the Bamboo server (or where the agents are running) the SonarClient for the technology that you want to analyze. And you just need to configure in the properties of that client, the url and credentials of the SonarQube server.
Even you can do this last thing directly when you are running the analyze, using the client parameters.

How to run web applications using jersey in an easy way?

I created a web application using Jersey through this maven code:
mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp \
-DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
-DgroupId=com.example -DartifactId=simple-service-webapp -Dpackage=com.example \
-DarchetypeVersion=2.4.1
And I am using Tomcat v7 as my Java server. When I finish writing some code, I use mvn's package command to generate a .war file, copy this file to the /webapps folder and then start tomcat to run my application and test it on browser. But I think I waste lots of time doing these things. So I want to ask if there is an easier way test my code on browsers. How do you guys run your web applications, especially Jersey app, on your server?
And I am using Intellij Idea, does it have some features that help me build and run Jersey apps, or other J2EE apps? how to use them?
In IntelliJ IDEA you can create a Tomcat Run/Debug configuration. In that configuration you can specify "before launch" tasks/options, including running a maven goal. So by running the Tomcat configuration, IDEA will run the maven goal, deploy your code to Tomcat, start the tomcat server, and (if desired) open you web browser to a specified page.
JetBrains has a Getting Started with Spring MVC, Hibernate and JSON tutorial. What you want to do is very similar. The main difference is you will need to remove the default "make" option in the "Before Launch" section at the bottom of the run/debug configuration and instead have it run your maven task.
There is also the Creating a simple Web application and deploying it to Tomcat tutorial. It's a little older and some of the options on the run/debug dialog have changed. But at the core, its still valid. Combined with the above, you should be in good shape.
Finally take a look at the Run/Debug Configuration: Tomcat page in the help guide (also available in the online webhelp).

Maven Sonar Plugin that generates HTML

Possibly a ridiculous question. But I'm a total noob with maven and sonar...
I'm using the sonar plugin for maven. It works great.
Using the command "mvn sonar:sonar" it connects to my localhost and I can view everything on port 9000.
What I'm wondering is:
Is it possible to generate all the files (eg. html, css, etc) without connecting to the server at port 9000?
If so, is there a command to do it?
If not :(
No that is not possible. Sonar is designed to have a server with a database and a client pulling the configs from the server and writing the results back to sonar.
If you want a solution without the sonar server you need to configure the maven findbugs plugin, cobertura, pmd and so on by your own and include there output in the maven site.
How this is done for findbugs is explained here:
How to generate a html report for findbugs with Maven 3.x

Bamboo doesn't recognize test in my Spring project

I have a Spring project (Apache CXF, Spring, Hibernate, Maven ...) hosted on BitBucket and I'm trying to use Bamboo as my CI server. My idea is deploying the code directly to Heroku from Bamboo so that deploying time is automated.
I made a plan with a couple of tasks to achieve this. First I have a Source Code Checkout task and a builder task. Both of them are working, code is compiling and test are passing, I can see that in the task log. The problem is that Bamboo doesn't seem to recognize the tests (it marks the task are testless).
I have also tried to create a new JUnit test task and it's even worst. Log shows that everything is working properly but Bamboo marks the plan as a failure after the test task is executed.
Any ideas?
Not sure which version of Bamboo you're using, but in the version that we have, you have to turn on unit test result evaluation on the Builder tab. Please see the attached screenshot, and make sure that this is enabled, and the directory setting is pointing to the directory where Maven Surefire creates the test results (in XML format).

Why use SonarQube plugin for Jenkins rather than simply use maven goal sonar:sonar?

I want to launch SonarQube analysis with Jenkins for a Maven 2 project. I first used the goal sonar:sonar in the build configuration.
But I just found the SonarQube plugin for Jenkins. Why use it? Is it a better practice and why?
You can of course do a simple mvn sonar:sonar, this will work.
On the other side, there's the SonarQube plugin for Jenkins that will make the configuration easier. For instance you will be able to define information about your SonarQube server (URL, DB user and password) or your multiple SonarQube servers in a single place (the configuration section of Jenkins) so that you don't have to repeat it everywhere.
The plugin also offers the ability to run a SonarQube analysis on the fly (without Maven): you just have to provide some mandatory properties (like sonar.projectKey and sonar.projectVersion for instance) and the plugin will start the Java Standalone Runner transparently for you (this is helpful mostly for other languages than Java which don't rely on Maven for their build).
So if you're just making some tests, you don't really need this plugin. But if you're setting up a production instance of Jenkins, then it's best to use the SonarQube plugin.

Resources