niedziela, 21 grudnia 2014

Jenkins and gradle - cooperation with sonar

This is my first english content on this blog. My native language is Polish.
I know, that my english is not perfect, so thank you for your understanding.
Initially this blog was created as English-language. Unfortunately I afraid of my grammar mistake, so I decided to return to my native language.


But end of year is good opportunity to new provisions relating to change content on foregin language.


Ok, let's start :)



Goal for today is Integration Continuous Integration and Continuous Inspection for Gradle applications.

First we should set proper setting in gradle script. This is quite easy :
I create script as above because this is very convienient way to potencial reuse it in next project configurations.
Fine, is seems to easy integration Jenkins and Sonar, but in practice I've found some complication.
Plugin delivered with Jenkins for me not work properly with sonar.
For me, it is appropriate to rely on the power and flexibility of Gradle.
It seems to me that this solution is quite obvious.
Gradle integrate very well with Sonar even if we say about applications based on Java 8.
This solution allow to run process invoke gradle command as : gradle sonarrunner.
If we click on http://localhost:9000/  URL, we will see Sonar dashboard.
You can immediately take a look at this and find out your project analysis.












Now, let's we go on to Jenkins settings. I expect, that project should be look like below.












This is pretty simple to do again.
For one thing, you must install plugin sidebar. This is very useful plugin,
that allows to define some url link and set associated with him icon. Then you will see result as picture above.











Now, what you should do is define gradle task as below.

















When you start building before configuration Jenkins task, you’ll see something like below :

As you can see Jenkins launch sonar task, then sonar have done a good job and analized your source code. If you go to Jenkins dashboard and click on new created URL you’ll see a analysis what you need.

That all.






Brak komentarzy:

Prześlij komentarz