Page tree
Skip to end of metadata
Go to start of metadata


Maven pom.xml Additions

Add this to your root pom.



Install a sonar helm chart

see DevOps#Deploysonarviahelmchart for older Helm 2.x charts via

Sonar Helm 3 Chart

install helm on top of your kubernetes cluster - Kubernetes Developer Guide#HelmCharts


biometric:wse_github michaelobrien$ helm repo add oteemocharts
"oteemocharts" has been added to your repositories
biometric:wse_github michaelobrien$ helm install sonar oteemocharts/sonarqube 
NAME: sonar
LAST DEPLOYED: Wed Apr 22 23:12:49 2020
NAMESPACE: default
STATUS: deployed
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app=sonarqube,release=sonar" -o jsonpath="{.items[0]}")
  echo "Visit to use your application"
  kubectl port-forward $POD_NAME 8080:9000

biometric:wse_github michaelobrien$ kubectl get services --all-namespaces
NAMESPACE     NAME                        TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
default       sonar-postgresql            ClusterIP     <none>        5432/TCP                     51s
default       sonar-postgresql-headless   ClusterIP      None             <none>        5432/TCP                     51s
default       sonar-sonarqube             ClusterIP    <none>        9000/TCP                     51s
biometric:wse_github michaelobrien$ kubectl get pods  --all-namespaces
NAMESPACE     NAME                                     READY   STATUS    RESTARTS   AGE
default       sonar-postgresql-0                       1/1     Running   0          2m12s
default       sonar-sonarqube-97b94c7f7-thrw2          1/1     Running   0          2m12s

$ helm list
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION
sonar   default         1               2020-04-23 11:59:18.6371016 -0400 EDT   deployed        sonarqube-6.0.1 8.2-community

biometric:wse_github michaelobrien$ kubectl port-forward sonar-sonarqube-97b94c7f7-thrw2 9000:9000
Forwarding from -> 9000
Forwarding from [::1]:9000 -> 9000
Handling connection for 9000

To avoid
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: (default-cli) on project difference-nbi: No quality profiles have been found, you probably don't have any language plugin installed. -> [Help 1]

install the java language in Administration | MarketplaceCheck the java profile in "quality profiles" after restarting the container

Install a sonar docker container

optional - use the chart instead

docker run -d --name sonarqube -p 9000:9000 sonarqube:latest

Run sonar:sonar maven target

 mvn clean install -U sonar:sonar -Dsonar.login=your_tokenor
biometric:difference-nbi michaelobrien$ mvn clean install -U sonar:sonar
[INFO] --- sonar-maven-plugin: (default-cli) @ difference-nbi ---
[INFO] User cache: /Users/michaelobrien/.sonar/cache
[INFO] SonarQube version: 8.2.0
[INFO] Default locale: "en_CA", source code encoding: "UTF-8"
[WARNING] SonarScanner will require Java 11 to run starting in SonarQube 8.x
[INFO] Load global settings
[INFO] Load global settings (done) | time=99ms
[INFO] Server id: D3E039A1-AXGlBrNXuSaXBupyXuQc
[INFO] User cache: /Users/michaelobrien/.sonar/cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=36ms
[INFO] Load/download plugins (done) | time=908ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=8ms
[INFO] Project key: cloud.difference:difference-nbi
[INFO] Base dir: /Users/michaelobrien/wse_gitlab/difference-cloud/difference-nbi
[INFO] Working dir: /Users/michaelobrien/wse_gitlab/difference-cloud/difference-nbi/target/sonar
[INFO] Load project settings for component key: 'cloud.difference:difference-nbi'
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=50ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=339ms
[WARNING] SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 7 files indexed
[INFO] Quality profile for java: Sonar way
[INFO] ------------- Run sensors on module nbi
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=39ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version ( 8
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=10ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=3ms
[INFO] Java Main Files AST scan
[INFO] 3 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=7ms
[INFO] 3/3 source files have been analyzed
[INFO] Java Main Files AST scan (done) | time=1046ms
[INFO] Java Test Files AST scan
[INFO] 1 source files to be analyzed
[INFO] Java Test Files AST scan (done) | time=51ms
[INFO] 1/1 source files have been analyzed
[INFO] Java Generated Files AST scan
[INFO] 0 source files to be analyzed
[INFO] Java Generated Files AST scan (done) | time=1ms
[INFO] 0/0 source files have been analyzed
[INFO] Sensor JavaSquidSensor [java] (done) | time=1247ms
[INFO] Sensor SurefireSensor [java]
[INFO] parsing [/Users/michaelobrien/wse_gitlab/difference-cloud/difference-nbi/target/surefire-reports]
[INFO] Sensor SurefireSensor [java] (done) | time=61ms
[INFO] Sensor JavaXmlSensor [java]
[INFO] Sensor JavaXmlSensor [java] (done) | time=0ms
[INFO] ------------- Run sensors on project
[INFO] Sensor Zero Coverage Sensor
[INFO] Sensor Zero Coverage Sensor (done) | time=7ms
[INFO] Sensor Java CPD Block Indexer
[INFO] Sensor Java CPD Block Indexer (done) | time=11ms
[INFO] SCM Publisher No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
[INFO] CPD Executor 1 file had no CPD blocks
[INFO] CPD Executor Calculating CPD for 2 files
[INFO] CPD Executor CPD calculation finished (done) | time=5ms
[INFO] Analysis report generated in 43ms, dir size=35 KB
[INFO] Analysis report compressed in 22ms, zip size=11 KB
[INFO] Analysis report uploaded in 302ms
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at
[INFO] Analysis total time: 2.545 s
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.934 s

Java Requirements

The following folders must have some minimal source



  • No labels