1. Download SonarQube from following link v 6.6.7
https://www.sonarqube.org/downloads/
2. Now Open your terminal and go to your downloaded sonarQube folder:
for example u are on root like:-
SupriyaMac:~ SupriyaBharti$ cd Downloads/sonarqube-6.7.6/bin/macosx-universal-64/
SupriyaMac:macosx-universal-64 SupriyaBharti$ ./sonar.sh start
Starting SonarQube...
SonarQube is already running.
Images:-
3. Now time to open sonar local host in your browser , please copy paste below link in your web browser:-
4. Open your android studio project and open the project build.gradle and add following :-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.1' // added for sonarQube
}
Images :-
5. Now open app build.gradle and add following :-
apply plugin: 'org.sonarqube' // added for sonar qube
// added for sonar qube
sonarqube {
properties {
property "sonar.projectName", "ContentResolver"
property "sonar.projectKey", "ContentResolver"
property "sonar.language", "java"
property "sonar.sources", "src/main/java"
property "sonar.java.sources", "src/main/java"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.login", "admin"
property "sonar.password", "admin"
}
}
Note :- Here in sonarQube property "sonar.sources", "src/main/java" this source path is very important .
Images :-
Note :- put sonar properties above dependencies.
6. Now open your terminal inside android studio
check you are at you current project root like for me my current project location will looks like following :-
SupriyaMac:ContentResolver SupriyaBharti$
7. Now run following command :
SupriyaMac:ContentResolver SupriyaBharti$ ./gradlew sonarqube -Dsonar.host.url=http://localhost:9000/
NOTE : no 7 is very important if you will not run this command than u will not able to connect your project with sonarLocal host.
8. Finally your refresh sonarQube local host and it will look look following :-
Images:-
For End to End sonar Qube integration you can also watch my youtube video :
https://www.youtube.com/watch?v=AjoI7EvVgMQ&t=4s
hello!
ReplyDeletei have a question for you..
can you contact me throw email?
thank you.
NIce
ReplyDeleteWhat went wrong:
ReplyDeleteExecution failed for task ':app:sonarqube'.
> Unable to execute SonarQube
hi,
ReplyDeleteI am getting below error while excuses ./gradlew sonarqube -Dsonar.host.url=http://localhost:9000/
Error
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
Pure a me succede hai capito perchè?
DeleteHI I am facing Execution failed for task ':app:compileDebugJavaWithJavac'.
ReplyDelete> javax/xml/bind/JAXBException
this exception from android studio
good and nice one
ReplyDeleteFull Stack Training in Chennai | Certification | Online Training Course | Full Stack Training in Bangalore | Certification | Online Training Course | Full Stack Training in Hyderabad | Certification | Online Training Course | Full Stack Training in Pune | Certification | Online Training Course | Full Stack Training | Certification | Full Stack Online Training Course
You have provided such a useful information in this blog. Thanks for sharing.
ReplyDeleteDevOps Training in Bangalore | Certification | Online Training Course institute | DevOps Training in Hyderabad | Certification | Online Training Course institute | DevOps Training in Coimbatore | Certification | Online Training Course institute | DevOps Online Training | Certification | Devops Training Online
i m getting bash: ./gradlew: /usr/bin/env: bad interpreter: Operation not permitted
ReplyDelete