I am fairly new with jenkins and sonar scanner. I have created a simple hello world gradle project in Intellij. After that was done, i added the Jenkinsfile to the root folder of the project and started working on it. When i try to build it in jenkins, i get an error message looking like this:
05:57:51.485 INFO: Scanner configuration file: /usr/lib/sonar-scanner/conf/sonar-scanner.properties
05:57:51.491 INFO: Project root configuration file: /root/src/sonar-project.properties
05:57:51.506 INFO: SonarQube Scanner 3.3.0.1492
05:57:51.506 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
05:57:51.506 INFO: Linux 3.10.0-957.5.1.el7.x86_64 amd64
05:57:51.702 DEBUG: keyStore is :
05:57:51.702 DEBUG: keyStore type is : jks
05:57:51.702 DEBUG: keyStore provider is :
05:57:51.702 DEBUG: init keystore
05:57:51.703 DEBUG: init keymanager of type SunX509
05:57:51.877 DEBUG: Create: /root/.sonar/cache
05:57:51.879 INFO: User cache: /root/.sonar/cache
05:57:51.879 DEBUG: Create: /root/.sonar/cache/_tmp
05:57:51.881 DEBUG: Extract sonar-scanner-api-batch in temp...
05:57:51.889 DEBUG: Get bootstrap index...
05:57:51.889 DEBUG: Download: http://10.221.4.33:9000/batch/index
05:57:51.968 DEBUG: Get bootstrap completed
05:57:51.986 DEBUG: Download http://10.221.4.33:9000/batch/file?name=sonar-scanner-engine-shaded-7.7-all.jar to /root/.sonar/cache/_tmp/fileCache3570509839777067796.tmp
05:57:52.323 DEBUG: Create isolated classloader...
05:57:52.333 DEBUG: Start temp cleaning...
05:57:52.338 DEBUG: Temp cleaning done
05:57:52.338 DEBUG: Execution getVersion
05:57:52.345 INFO: SonarQube server 7.7.0
05:57:52.346 DEBUG: Execution execute
05:57:52.801 INFO: Load global settings
05:57:52.879 DEBUG: GET 200 http://10.221.4.33:9000/api/settings/values.protobuf | time=58ms
05:57:52.936 INFO: Load global settings (done) | time=138ms
05:57:52.944 INFO: Server id: C9A263D1-AWnZoCq1phaxFFDSMo0l
05:57:52.966 DEBUG: Create : /root/.sonar/_tmp
05:57:52.967 INFO: User cache: /root/.sonar/cache
05:57:52.971 INFO: Load/download plugins
05:57:52.972 INFO: Load plugins index
05:57:52.981 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/installed | time=9ms
05:57:53.025 INFO: Load plugins index (done) | time=52ms
05:57:53.027 DEBUG: Download plugin 'scmgit' to '/root/.sonar/_tmp/fileCache4395394311979981807.tmp'
05:57:53.034 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=scmgit&acceptCompressions=pack200 | time=7ms
05:57:53.112 DEBUG: Download plugin 'jacoco' to '/root/.sonar/_tmp/fileCache6933684684880586527.tmp'
05:57:53.118 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=jacoco&acceptCompressions=pack200 | time=6ms
05:57:53.119 DEBUG: Download plugin 'ldap' to '/root/.sonar/_tmp/fileCache7133022802065402857.tmp'
05:57:53.128 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=ldap&acceptCompressions=pack200 | time=8ms
05:57:53.136 DEBUG: Download plugin 'csharp' to '/root/.sonar/_tmp/fileCache9082420825692938062.tmp'
05:57:53.150 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=csharp&acceptCompressions=pack200 | time=13ms
05:57:53.241 DEBUG: Download plugin 'cssfamily' to '/root/.sonar/_tmp/fileCache293189218006487968.tmp'
05:57:53.246 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=cssfamily&acceptCompressions=pack200 | time=5ms
05:57:53.301 DEBUG: Download plugin 'clojure' to '/root/.sonar/_tmp/fileCache948669080401350606.tmp'
05:57:53.307 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=clojure&acceptCompressions=pack200 | time=6ms
05:57:53.379 DEBUG: Download plugin 'flex' to '/root/.sonar/_tmp/fileCache3889788857842376851.tmp'
05:57:53.386 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=flex&acceptCompressions=pack200 | time=7ms
05:57:53.401 DEBUG: Download plugin 'go' to '/root/.sonar/_tmp/fileCache4205858474210720715.tmp'
05:57:53.408 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=go&acceptCompressions=pack200 | time=7ms
05:57:53.462 DEBUG: Download plugin 'web' to '/root/.sonar/_tmp/fileCache783608628579300027.tmp'
05:57:53.470 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=web&acceptCompressions=pack200 | time=8ms
05:57:53.502 DEBUG: Download plugin 'javascript' to '/root/.sonar/_tmp/fileCache895874836559468181.tmp'
05:57:53.523 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=javascript&acceptCompressions=pack200 | time=20ms
05:57:53.641 DEBUG: Download plugin 'java' to '/root/.sonar/_tmp/fileCache2653809152725468294.tmp'
05:57:53.649 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=java&acceptCompressions=pack200 | time=8ms
05:57:53.724 DEBUG: Download plugin 'kotlin' to '/root/.sonar/_tmp/fileCache4849792320171587582.tmp'
05:57:53.731 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=kotlin&acceptCompressions=pack200 | time=7ms
05:57:53.819 DEBUG: Download plugin 'php' to '/root/.sonar/_tmp/fileCache6204606293784138971.tmp'
05:57:53.826 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=php&acceptCompressions=pack200 | time=7ms
05:57:53.877 DEBUG: Download plugin 'python' to '/root/.sonar/_tmp/fileCache288964667021647401.tmp'
05:57:53.885 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=python&acceptCompressions=pack200 | time=7ms
05:57:53.910 DEBUG: Download plugin 'ruby' to '/root/.sonar/_tmp/fileCache5281102871587928818.tmp'
05:57:53.915 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=ruby&acceptCompressions=pack200 | time=4ms
05:57:53.993 DEBUG: Download plugin 'sonarscala' to '/root/.sonar/_tmp/fileCache1960676723457785292.tmp'
05:57:53.998 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=sonarscala&acceptCompressions=pack200 | time=5ms
05:57:54.070 DEBUG: Download plugin 'typescript' to '/root/.sonar/_tmp/fileCache7183740303261272847.tmp'
05:57:54.076 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=typescript&acceptCompressions=pack200 | time=6ms
05:57:54.095 DEBUG: Download plugin 'vbnet' to '/root/.sonar/_tmp/fileCache7315453031927695364.tmp'
05:57:54.100 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=vbnet&acceptCompressions=pack200 | time=5ms
05:57:54.170 DEBUG: Download plugin 'xml' to '/root/.sonar/_tmp/fileCache226747213883935028.tmp'
05:57:54.177 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=xml&acceptCompressions=pack200 | time=6ms
05:57:54.198 DEBUG: Download plugin 'scmsvn' to '/root/.sonar/_tmp/fileCache1337467676129254645.tmp'
05:57:54.203 DEBUG: GET 200 http://10.221.4.33:9000/api/plugins/download?plugin=scmsvn&acceptCompressions=pack200 | time=5ms
05:57:54.257 INFO: Load/download plugins (done) | time=1286ms
05:57:54.464 DEBUG: Plugins:
05:57:54.464 DEBUG: * SonarPython 1.13.0.2922 (python)
05:57:54.464 DEBUG: * SonarCSS 1.0.3.724 (cssfamily)
05:57:54.464 DEBUG: * SonarClojure 1.8.1 (clojure)
05:57:54.464 DEBUG: * JaCoCo 1.0.1.143 (jacoco)
05:57:54.464 DEBUG: * SonarGo 1.1.0.1612 (go)
05:57:54.464 DEBUG: * SonarKotlin 1.5.0.315 (kotlin)
05:57:54.464 DEBUG: * Svn 1.9.0.1295 (scmsvn)
05:57:54.464 DEBUG: * SonarJS 5.1.1.7506 (javascript)
05:57:54.464 DEBUG: * SonarRuby 1.5.0.315 (ruby)
05:57:54.465 DEBUG: * SonarScala 1.5.0.315 (sonarscala)
05:57:54.465 DEBUG: * SonarC# 7.14.0.8411 (csharp)
05:57:54.465 DEBUG: * SonarJava 5.12.1.17771 (java)
05:57:54.465 DEBUG: * LDAP 2.2.0.608 (ldap)
05:57:54.465 DEBUG: * SonarHTML 3.1.0.1615 (web)
05:57:54.465 DEBUG: * Git 1.8.0.1574 (scmgit)
05:57:54.465 DEBUG: * SonarFlex 2.4.0.1222 (flex)
05:57:54.465 DEBUG: * SonarXML 2.0.1.2020 (xml)
05:57:54.465 DEBUG: * SonarPHP 3.0.0.4537 (php)
05:57:54.465 DEBUG: * SonarTS 1.9.0.3766 (typescript)
05:57:54.465 DEBUG: * SonarVB 7.14.0.8411 (vbnet)
05:57:54.493 INFO: ------------------------------------------------------------------------
05:57:54.493 INFO: EXECUTION FAILURE
05:57:54.493 INFO: ------------------------------------------------------------------------
05:57:54.493 INFO: Total time: 3.042s
05:57:54.591 INFO: Final Memory: 9M/597M
05:57:54.591 INFO: ------------------------------------------------------------------------
05:57:54.591 ERROR: Error during SonarQube Scanner execution
05:57:54.591 ERROR: Tasks support was removed in SonarQube 7.6.
I have tried searching for the error (Tasks support was removed in Sonarqube 7.6) which really havent helped me at all so far. I've tried seperate ways of constructing the Jenkinsfile but seems to be no luck at all.
This is my jenkinsfile:
pipeline {
agent any
stages {
stage('List folder') {
steps {
sh 'ls'
}
}
stage('Make folder for docker') {
steps {
sh 'docker run -v $(pwd):/root/src newtmitch/sonar-scanner sonar-scanner -X \
-Dsonar.host.url=http://XXXX:9000 \
-Dsonar.jdbc.url=jdbc:h2:tcp://sonarqube/sonar \
-Dsonar.projectKey=MyProjectKey \
-Dsonar.projectName="My Project Name" \
-Dsonar.projectVersion=1 \
-Dsonar.projectBaseDir=/root/src \
-Dsonar.sources=/root/src'
}
}
}
}
It seems to be able to get the right docker image from sonar scanner, but why is it failing afterwards? The steps should be somewhat simple: 1. Get image. 2. Build Gradle project 3. Scan project code 4. Profit.
In case anyone runs into this, i solved it by removing "sonar-scanner -X" from the docker run command.
unsure why it changed anything but now it can analyze the project code correctly.
thanks