#Configure here general information about the environment, such as SonarQube DB details for example
#No information about specific project should appear here
#----- Default SonarQube server
sonar.host.url=http://9.46.xxx.yyy:9000/
#----- Default source code encoding
#sonar.sourceEncoding=UTF-8
In SonarQube:
Created an authentication token as mentioned above
Created a webhook in Administration > Configuration > Webhooks:
I tried changing sonar-scanner to sonar-scanner ${branch != 'master' ? "-Dsonar.branch.name=${branch}" : ''} but it didn’t seem to make a difference. Still complaining that it can’t find report-task.txt…
Can you please help me here?
The difference between the working and not-working analysis is that:
In the working one, it’s a repository that its main branch is the develop branch
In the not-working one, it’s a repository that its main branch is the master branch
For both repositories this was their first-ever run and they did not have a project in SonarQube.
How do I resolve this? We cannot yet upgrade to v8 and we cannot create a develop branch.
what is your scanner version ?
i’ve asked because the ‘unable to locate report-task.txt’ appears for different errors, but we need
to find the root cause.
So, there are no more Sonarqube related entries in the Jenkins console log ?
Please adjust the loglevel for the scanner like that sh "sonar-scanner -X" to get more output.
To go further we need to check the Sonarqube server logs located in
$SONARQUBE_HOME/logs for related entries, e.g. when using permission templates and the projektkey matches multiple permission templates it is seen in web.log
It’s also recommended to create a log recorder for Sonarqube in Jenkins via
But it seems a similar problem with the initial scan as descibed in the mentioned thread.
This problem with the initial scan and the use of sonar.branch.name is fixed in version 8.
i’ve created a shared library in Jenkins that checks via Sonarqube web api if the project exists and if not creates it, as we’re still bound to version 7.9.x
After all you can create the Sonarqube project manually.
After all you can create the Sonarqube project manually.
I’ve created it manually and ran both sonar-scanner and sonar-scanner ${branch != 'master' ? "-Dsonar.branch.name=${branch}" : ''} with the same error.
It’s confusing that your jenkins console log has not more entries - even with using -X = loglevel debug !?
Already with normal loglevel and regardless of the scanner (cli, maven …) there should be entries like
that, e.g. a Jenkins console log of a windows node using the cli scanner:
[Pipeline] withSonarQubeEnv
Injecting SonarQube environment variables using the configuration: SONARFOO
[Pipeline] {
[Pipeline] bat
E:\Jenkins\workspace\foo-bar_master-H3VR45APWDZ47PTGKRBPLPNELBVOJBC245QGTEGBWFHRWCHIZASQ>E:\Jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarQube_Scanner_4.0.0\sonar-scanner-4.0.0.1744/bin/sonar-scanner
INFO: Scanner configuration file: E:\Jenkins\tools\hudson.plugins.sonar.SonarRunnerInstallation\SonarQube_Scanner_4.0.0\sonar-scanner-4.0.0.1744\bin..\conf\sonar-scanner.properties
INFO: Project root configuration file: E:\Jenkins\workspace\foo-bar-H3VR45APWDZ47PTGKRBPLPNELBVOJBC245QGTEGBWFHRWCHIZASQ\sonar-project.properties
INFO: SonarQube Scanner 4.0.0.1744
INFO: Java 1.8.0_60 Oracle Corporation (64-bit)
INFO: Windows NT (unknown) 10.0 amd64
INFO: User cache: E:\UserHome\sonar\cache
INFO: SonarQube server 7.9.1
INFO: Default locale: “de_DE”, source code encoding: “UTF-8”
WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x
INFO: Load global settings
INFO: Load global settings (done) | time=182ms
INFO: Server id: xxx-xxx
INFO: User cache: E:\UserHome\sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=51ms
INFO: Load/download plugins (done) | time=174ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=3ms
INFO: Project key: com.foo.bar:foo-bar
INFO: Base dir: E:\Jenkins\workspace\foo-bar_master-H3VR45APWDZ47PTGKRBPLPNELBVOJBC245QGTEGBWFHRWCHIZASQ
INFO: Working dir: E:\Jenkins\workspace\foo-bar_master-H3VR45APWDZ47PTGKRBPLPNELBVOJBC245QGTEGBWFHRWCHIZASQ.scannerwork
INFO: Load project settings for component key: ‘com.foo.bar:foo-bar’
INFO: Load project settings for component key: ‘com.foo.bar:foo-bar’ (done) | time=31ms
[…]
Checking your provided Sonarqube server logs:
the access.log has only successful submits with http 200 for different projectKeys
only the web.log has one exception
2020.04.23 06:32:19> INFO web[o.a.c.h.Http11Processor] Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
Never had seen this, searching the web indicates that is because
This exception can occur when you try to execute HTTPS request from client on endpoint which isn’t HTTPS enabled. Client will encrypt request data when server is expecting raw data.
Didn’t find any other suspicious entries in the logs.
Just guessing = maybe the one job failing runs on another jenkins node that’s
not configured correctly, http ↔ https !?
Did the Jenkins logrecorder reveal something ?
Maybe you can provide the sonar-project.property file of both projects = works / works not ?