SonarSource / sonar-scanner-msbuild

SonarScanner for .NET
http://redirect.sonarsource.com/doc/msbuild-sq-runner.html
GNU Lesser General Public License v3.0
364 stars 142 forks source link

Test 7.0.0 release #2024

Closed costin-zaharia-sonarsource closed 3 months ago

costin-zaharia-sonarsource commented 4 months ago

Scenarios

Parameters

JRE downloading

Specification

CLI Execution

ITs

Others

martin-strecker-sonarsource commented 3 months ago

sonar.scanner.sonarcloudUrl

General

Tested with sonar-scanner-7.0.0.95453-net-framework.zip and the https://sonarcloud.io/project/configuration/GitHubManual?id=SonarSource_sonar-scanner-azdo-test SC project. For SC I used sonarqube-10.7.0.92547 from jfrog. See also https://sonarsource.slack.com/archives/D04DC2FDMK5/p1721045533900749

Example commands

E:\sonarscanner-net-framework\SonarScanner.MSBuild.exe begin /o:"sonarsource" /k:"SonarSource_sonar-scanner-azdo-test" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.token="<<~~>>" /d:sonar.verbose=true

E:\sonarscanner-net-framework\SonarScanner.MSBuild.exe begin /k:"JRE-Cache-test" /d:sonar.host.url="http://localhost:9000" /d:sonar.token="<<~~>>" /d:sonar.verbose=true
Log
SonarScanner for MSBuild 7.0
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at E:\sonarscanner-net-framework\SonarQube.Analysis.xml
Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
sonar.verbose=true was specified - setting the log verbosity to 'Debug'
Pre-processing started.
Preparing working directories...
Using environment variables to determine the download directory...
12:42:52.066  12:42:52.048  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
12:42:52.067  12:42:52.059  Server Url: https://sonarcloud.io
12:42:52.067  12:42:52.059  Api Url: https://api.sonarcloud.io
12:42:52.068  12:42:52.059  Is SonarCloud: True
12:42:52.068  12:42:52.066  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
12:42:52.07  Updating build integration targets...
12:42:52.075  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
12:42:52.075  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
12:42:52.075  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
12:42:52.076  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
12:42:52.076  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
12:42:52.076  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
12:42:52.077  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
12:42:52.081  Installed SonarQube.Integration.targets to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\bin\targets
12:42:52.081  Creating config and output folders...
12:42:52.082  Creating directory: C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf
12:42:52.082  Creating directory: C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\out
12:42:52.127  Downloading from https://sonarcloud.io/api/settings/values?component=unknown...
12:42:52.342  Response received from https://sonarcloud.io/api/settings/values?component=unknown...
12:42:52.345  Fetching server version...
12:42:52.348  Downloading from https://api.sonarcloud.io/analysis/version...
12:42:52.531  Response received from https://api.sonarcloud.io/analysis/version...
12:42:52.531  Downloading from https://api.sonarcloud.io/analysis/version failed. Http status code is Forbidden.
12:42:52.532  Downloading from https://sonarcloud.io/api/server/version...
12:42:52.586  Response received from https://sonarcloud.io/api/server/version...
12:42:52.594  SonarCloud detected, skipping server version check.
12:42:52.595  SonarCloud detected, skipping license check.
12:42:52.597  JreResolver: Resolving JRE path.
12:42:52.605  Downloading from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
12:42:52.814  Response received from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
12:42:52.829  JreResolver: Cache hit 'C:\Users\martin.strecker\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
12:42:52.832  Fetching analysis configuration settings...
12:42:52.835  Fetching properties for project 'SonarSource_sonar-scanner-azdo-test'...
12:42:52.836  Downloading from https://sonarcloud.io/api/settings/values?component=SonarSource_sonar-scanner-azdo-test...
12:42:52.88  Response received from https://sonarcloud.io/api/settings/values?component=SonarSource_sonar-scanner-azdo-test...
12:42:52.884  Downloading from https://sonarcloud.io/api/languages/list...
12:42:52.91  Response received from https://sonarcloud.io/api/languages/list...
12:42:52.913  Fetching quality profile for project 'SonarSource_sonar-scanner-azdo-test'...
12:42:52.913  Downloading from https://sonarcloud.io/api/qualityprofiles/search?project=SonarSource_sonar-scanner-azdo-test&organization=sonarsource...
12:42:53  Response received from https://sonarcloud.io/api/qualityprofiles/search?project=SonarSource_sonar-scanner-azdo-test&organization=sonarsource...
12:42:53.004  Fetching rules for quality profile 'AVxYKDdrFTbgxqUNcakm'...
12:42:53.004  Downloading from https://sonarcloud.io/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AVxYKDdrFTbgxqUNcakm&p=1...
12:42:53.122  Response received from https://sonarcloud.io/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AVxYKDdrFTbgxqUNcakm&p=1...
12:42:53.136  Local analyzer cache: C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources
12:42:53.141  Writing Roslyn generated ruleset to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\Sonar-cs.ruleset...
12:42:53.15  Writing Roslyn generated ruleset to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\Sonar-cs-none.ruleset...
12:42:53.154  Provisioning analyzer assemblies for cs...
12:42:53.156  Installing required Roslyn analyzers...
12:42:53.157  Processing plugin: csharp version 9.29.0.95321
12:42:53.16  Cache hit: using plugin files from C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources\0
12:42:53.16  Processing plugin: vbnet version 9.29.0.95321
12:42:53.161  Cache hit: using plugin files from C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources\1
12:42:53.161  Processing plugin: securitycsharpfrontend version 10.6.0.31509
12:42:53.162  Cache hit: using plugin files from C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources\2
12:42:53.165  Writing Roslyn analyzer additional file to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\cs\SonarLint.xml...
12:42:53.167  Fetching quality profile for project 'SonarSource_sonar-scanner-azdo-test'...
12:42:53.168  Downloading from https://sonarcloud.io/api/qualityprofiles/search?project=SonarSource_sonar-scanner-azdo-test&organization=sonarsource...
12:42:53.263  Response received from https://sonarcloud.io/api/qualityprofiles/search?project=SonarSource_sonar-scanner-azdo-test&organization=sonarsource...
12:42:53.264  Fetching rules for quality profile 'AVxYU8keFTbgxqUN2RRL'...
12:42:53.265  Downloading from https://sonarcloud.io/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AVxYU8keFTbgxqUN2RRL&p=1...
12:42:53.332  Response received from https://sonarcloud.io/api/rules/search?f=repo,name,severity,lang,internalKey,templateKey,params,actives&ps=500&qprofile=AVxYU8keFTbgxqUN2RRL&p=1...
12:42:53.335  Local analyzer cache: C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources
12:42:53.337  Writing Roslyn generated ruleset to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\Sonar-vbnet.ruleset...
12:42:53.338  Writing Roslyn generated ruleset to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\Sonar-vbnet-none.ruleset...
12:42:53.34  Provisioning analyzer assemblies for vbnet...
12:42:53.34  Installing required Roslyn analyzers...
12:42:53.34  Processing plugin: csharp version 9.29.0.95321
12:42:53.341  Cache hit: using plugin files from C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources\0
12:42:53.341  Processing plugin: vbnet version 9.29.0.95321
12:42:53.342  Cache hit: using plugin files from C:\Users\martin.strecker\AppData\Local\Temp\.sonarqube\resources\1
12:42:53.342  Writing Roslyn analyzer additional file to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf\vbnet\SonarLint.xml...
12:42:53.346  Processing analysis cache
12:42:53.349  Incremental PR analysis: Base branch parameter was not provided.
12:42:53.35  Cache data is empty. A full analysis will be performed.
12:42:53.367  Pre-processing succeeded.

java.exe from the cache is used during the end step:

C:\Projects> Get-Process -Name java | select CommandLine | fl

CommandLine : "C:\Users\martin.strecker\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre\bin\java.exe"
                -Djava.awt.headless=true   -cp "E:\sonarscanner-net-framework\sonar-scanner-5.0.1.3006\bin\..\lib\sonar-scanner-cli-5.0.1.3006.jar"
              "-Dscanner.home=E:\sonarscanner-net-framework\sonar-scanner-5.0.1.3006\bin\.." "-Dproject.home=C:\Projects\sonar-scanner-vsts-test\src" org.sonarsource.scanner.cli.Main
              "-Dsonar.token=<<~~>>" "-Dsonar.scanAllFiles=true" "-Dproject.settings=C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\out\sonar-project.properties"
              "--from=ScannerMSBuild/7.0" "--debug"

/d:sonar.host.url="https://sonarcloud.io"

🟒 No special output:

12:58:18.46  12:58:18.439  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
12:58:18.462  12:58:18.451  Server Url: https://sonarcloud.io
12:58:18.463  12:58:18.451  Api Url: https://api.sonarcloud.io
12:58:18.463  12:58:18.451  Is SonarCloud: True
12:58:18.463  12:58:18.46  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

/d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.sonarcloudUrl="https://sonarcloud.io"

🟒 Warning raised.

12:59:14.507  12:59:14.488  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
12:59:14.507  12:59:14.499  12:59:14.499  WARNING: The arguments 'sonar.host.url' and 'sonar.scanner.sonarcloudUrl' are both set. Please set only 'sonar.scanner.sonarcloudUrl'.
12:59:14.507  12:59:14.499  Server Url: https://sonarcloud.io
12:59:14.508  12:59:14.499  Api Url: https://api.sonarcloud.io
12:59:14.508  12:59:14.499  Is SonarCloud: True
12:59:14.508  12:59:14.507  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

/d:sonar.host.url="https://sonarcloud.io" /d:sonar.scanner.sonarcloudUrl="https://test.io"

🟒 begin step fails with an error.

13:06:00.03  13:06:00.013  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
13:06:00.031  13:06:00.026  The arguments 'sonar.host.url' and 'sonar.scanner.sonarcloudUrl' are both set and are different. Please set either 'sonar.host.url' for SonarQube or 'sonar.scanner.sonarcloudUrl' for SonarCloud.
13:06:00.032  Expecting at least the following command line argument:
- SonarQube/SonarCloud project key
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
Use '/?' or '/h' to see the help message.
13:06:00.033  Pre-processing failed. Exit code: 1

<<no server specified>>

🟒sonarcloud is used as the default

13:09:10.81  13:09:10.791  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
13:09:10.81  13:09:10.801  Server Url: https://sonarcloud.io
13:09:10.81  13:09:10.801  Api Url: https://api.sonarcloud.io
13:09:10.81  13:09:10.801  Is SonarCloud: True

<<no server specified>> invalid token

πŸ”΄ sonarcloud.io is the default. The analysis fails. The user gets a message about the breaking change and what needs to be done. The message has an error: /d:sonar.host.url=https://localhost:9000" is shown, but the old default was /d:sonar.host.url=http://localhost:9000" (HTTP instead of https). Fix #2057

13:14:07.791  13:14:07.768  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
13:14:07.791  13:14:07.78  Server Url: https://sonarcloud.io
13:14:07.791  13:14:07.78  Api Url: https://api.sonarcloud.io
13:14:07.792  13:14:07.78  Is SonarCloud: True
13:14:07.792  13:14:07.791  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
...
13:14:07.862  Downloading from https://sonarcloud.io/api/settings/values?component=unknown...
13:14:08.099  Response received from https://sonarcloud.io/api/settings/values?component=unknown...
13:14:08.101  13:14:08.101  WARNING: Authentication with the server has failed.
13:14:08.101  13:14:08.101  WARNING: In version 7 of the scanner, the default value for the sonar.host.url changed from "http://localhost:9000" to "https://sonarcloud.io".
If the intention was to connect to the local SonarQube instance, please add the "/d:sonar.host.url=https://localhost:9000" parameter.
13:14:08.102  Pre-processing failed. Exit code: 1

/d:sonar.scanner.sonarcloudUrl="https://InvalidSonarCloud.io"

🟒https://InvalidSonarCloud.io is used. The analysis fails later with Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://invalidsonarcloud.io/api/settings/values?component=unknown'.

13:10:50.401  13:10:50.379  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
13:10:50.402  13:10:50.391  Server Url: https://InvalidSonarCloud.io
13:10:50.403  13:10:50.391  Api Url: https://api.sonarcloud.io
13:10:50.403  13:10:50.391  Is SonarCloud: True
13:10:50.404  13:10:50.401  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

/d:sonar.host.url="http://localhost:9000"

🟒 SQ 10.7 is contacted successfully.

15:08:03.084  15:08:03.066  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
15:08:03.084  15:08:03.076  Server Url: http://localhost:9000
15:08:03.085  15:08:03.076  Api Url: http://localhost:9000/api/v2
15:08:03.085  15:08:03.076  Is SonarCloud: False
15:08:03.085  15:08:03.084  sonar.verbose=true was specified - setting the log verbosity to 'Debug'

/d:sonar.host.url="http://localhost:9000" /d:sonar.scanner.sonarcloudUrl="http://localhost:9000"

🟒 SQ 10.7 is contacted but the mismatch SQ/SC is detected:

Using environment variables to determine the download directory...
15:10:27.925  15:10:27.906  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
15:10:27.925  15:10:27.916  15:10:27.916  WARNING: The arguments 'sonar.host.url' and 'sonar.scanner.sonarcloudUrl' are both set. Please set only 'sonar.scanner.sonarcloudUrl'.
15:10:27.925  15:10:27.916  Server Url: http://localhost:9000
15:10:27.925  15:10:27.916  Api Url: https://api.sonarcloud.io
15:10:27.926  15:10:27.916  Is SonarCloud: True
15:10:27.926  15:10:27.925  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
15:10:27.928  Updating build integration targets...
15:10:27.931  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore
15:10:27.932  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\10.0\Microsoft.Common.targets\ImportBefore
15:10:27.932  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\11.0\Microsoft.Common.targets\ImportBefore
15:10:27.932  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore
15:10:27.933  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore
15:10:27.933  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\15.0\Microsoft.Common.targets\ImportBefore
15:10:27.933  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\martin.strecker\AppData\Local\Microsoft\MSBuild\Current\Microsoft.Common.targets\ImportBefore
15:10:27.938  Installed SonarQube.Integration.targets to C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\bin\targets
15:10:27.938  Creating config and output folders...
15:10:27.939  Creating directory: C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\conf
15:10:27.94  Creating directory: C:\Projects\sonar-scanner-vsts-test\src\.sonarqube\out
15:10:27.99  Downloading from http://localhost:9000/api/settings/values?component=unknown...
15:10:28.056  Response received from http://localhost:9000/api/settings/values?component=unknown...
15:10:28.058  Fetching server version...
15:10:28.06  Downloading from https://api.sonarcloud.io/analysis/version...
15:10:29.237  Response received from https://api.sonarcloud.io/analysis/version...
15:10:29.238  Downloading from https://api.sonarcloud.io/analysis/version failed. Http status code is Forbidden.
15:10:29.239  Downloading from http://localhost:9000/api/server/version...
15:10:29.242  Response received from http://localhost:9000/api/server/version...
15:10:29.249  Detected SonarCloud but server was found to be SonarQube. Please make sure the correct combination of 'sonar.host.url' and 'sonar.scanner.sonarcloudUrl' is set.
15:10:29.25  Pre-processing failed. Exit code: 1
martin-strecker-sonarsource commented 3 months ago

Test that the caching directory for S4NET is the same directory as the scanner CLI version 6 bootstrapping cache (to avoid double bootstraps when we embed the CLI version 6).

The java scanner-cli uses .sonar\cache\<<sha>>\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_unzip\jdk-17.0.11+9-jre/bin/java.exe instead of .sonar\cache\<<sha>>\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe There is a ticket on for the scanner-cli SCANJLIB-228

martin-strecker-sonarsource commented 3 months ago

sonar.scanner.apiBaseUrl

No value

🟒 SQ/SC are both fine

16:14:56.388  16:14:56.373  Server Url: https://sonarcloud.io
16:14:56.388  16:14:56.373  Api Url: https://api.sonarcloud.io
16:14:56.389  16:14:56.373  Is SonarCloud: True

16:15:27.454  16:15:27.439  Server Url: http://localhost:9000
16:15:27.454  16:15:27.44  Api Url: http://localhost:9000/api/v2
16:15:27.455  16:15:27.44  Is SonarCloud: False

Set to valid values (defaults)

🟒 SQ/SC okay. The Uri seems to be taken:

/d:sonar.scanner.apiBaseUrl=HTTPS://API.SonarCloud.io

16:17:15.52  16:17:15.507  Server Url: https://sonarcloud.io
16:17:15.52  16:17:15.507  Api Url: HTTPS://API.SonarCloud.io
16:17:15.522  16:17:15.507  Is SonarCloud: True

...
16:17:15.967  Downloading from https://sonarcloud.io/api/server/version...
16:17:16.011  Response received from https://sonarcloud.io/api/server/version...
16:17:16.025  SonarCloud detected, skipping server version check.
16:17:16.026  SonarCloud detected, skipping license check.
16:17:16.028  JreResolver: Resolving JRE path.
16:17:16.04  Downloading from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
16:20:40.134  16:20:40.12  Server Url: http://localhost:9000
16:20:40.135  16:20:40.12  Api Url: HTTP://LocalHost:9000/api/v2
16:20:40.135  16:20:40.12  Is SonarCloud: False
...
16:20:40.238  Downloading from http://localhost:9000/api/settings/values?component=unknown...
16:20:40.347  Response received from http://localhost:9000/api/settings/values?component=unknown...
16:20:40.35  Fetching server version...
16:20:40.354  Downloading from http://localhost:9000/api/v2/analysis/version...
16:20:40.36  Response received from http://localhost:9000/api/v2/analysis/version...
16:20:40.376  Checking if the server version is supported...
16:20:40.387  Checking validity of server license...
16:20:40.387  Downloading from http://localhost:9000/api/editions/is_valid_license...
16:20:40.394  Response received from http://localhost:9000/api/editions/is_valid_license...
16:20:40.403  JreResolver: Resolving JRE path.
16:20:40.409  Downloading from http://localhost:9000/api/v2/analysis/jres?os=windows&arch=x64...

Valid Endpoint SC

myapi.somedomain.it was added to HOSTS to point to 18.199.29.252 🟒 API Url is respected. The connection fails with SSL/errors, which is good (the server name in the certificate does not match the domain name of the request). JRE Provisioning fails, but the begin step in total successeds.

16:26:57.789  16:26:57.776  Server Url: https://sonarcloud.io
16:26:57.789  16:26:57.776  Api Url: https://myapi.somedomain.it
16:26:57.789  16:26:57.776  Is SonarCloud: True
...
16:26:58.152  Fetching server version...
16:26:58.155  Downloading from https://myapi.somedomain.it/analysis/version...
16:26:58.279  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/version'.
16:26:58.283  System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
16:26:58.284  Downloading from https://sonarcloud.io/api/server/version...
16:26:58.315  Response received from https://sonarcloud.io/api/server/version...
16:26:58.328  SonarCloud detected, skipping server version check.
16:26:58.329  SonarCloud detected, skipping license check.
16:26:58.333  JreResolver: Resolving JRE path.
16:26:58.344  Downloading from https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64...
16:26:58.41  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64'.
16:26:58.41  System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
16:26:58.412  16:26:58.412  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
16:26:58.413  JreResolver: Metadata could not be retrieved.
16:26:58.413  JreResolver: Resolving JRE path. Retrying...
16:26:58.414  Downloading from https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64...
16:26:58.479  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64'.
16:26:58.48  System.Net.WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
   at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
   --- End of inner exception stack trace ---
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
16:26:58.48  16:26:58.48  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
16:26:58.481  JreResolver: Metadata could not be retrieved.
16:26:58.485  Fetching analysis configuration settings...

Valid Endpoint SQ

/d:sonar.scanner.apiBaseUrl="http://myapi.somedomain.it:9000/api/v2". myapi.somedomain.it was redirected to 127.0.0.1 via HOSTS file.

🟒 The API Url is respected for the JRE caching and server version testing.

16:33:22.503  16:33:22.494  Server Url: http://localhost:9000
16:33:22.503  16:33:22.494  Api Url: http://myapi.somedomain.it:9000
16:33:22.504  16:33:22.494  Is SonarCloud: False
16:33:22.504  16:33:22.502  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
...
16:34:34.519  Downloading from http://localhost:9000/api/settings/values?component=unknown...
16:34:34.585  Response received from http://localhost:9000/api/settings/values?component=unknown...
16:34:34.586  Fetching server version...
16:34:34.589  Downloading from http://myapi.somedomain.it:9000/api/v2/analysis/version...
16:34:34.596  Response received from http://myapi.somedomain.it:9000/api/v2/analysis/version...
16:34:34.605  Checking if the server version is supported...
16:34:34.612  Checking validity of server license...
16:34:34.612  Downloading from http://localhost:9000/api/editions/is_valid_license...
16:34:34.617  Response received from http://localhost:9000/api/editions/is_valid_license...
16:34:34.622  JreResolver: Resolving JRE path.
16:34:34.625  Downloading from http://myapi.somedomain.it:9000/api/v2/analysis/jres?os=windows&arch=x64...
16:34:34.629  Response received from http://myapi.somedomain.it:9000/api/v2/analysis/jres?os=windows&arch=x64...
16:34:34.643  JreResolver: Cache hit 'C:\Users\martin.strecker\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
16:34:34.647  Fetching analysis configuration settings...

Invalid endpoint SQ

/d:sonar.scanner.apiBaseUrl="http://ogl5q.wiremockapi.cloud/"

🟑 The endpoint is retried, which is technically not correct. This isn't a big deal, but the retry should only be done in the case of an SHA checksum mismatch. All the remaining behavior is correct: the begin step succeeds.

17:13:15.274  17:13:15.266  Server Url: http://localhost:9000
17:13:15.274  17:13:15.266  Api Url: http://ogl5q.wiremockapi.cloud/
17:13:15.276  17:13:15.266  Is SonarCloud: False
...
17:13:15.63  JreResolver: Resolving JRE path.
17:13:15.634  Downloading from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64...
17:13:15.8  Response received from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64...
17:13:15.801  Downloading from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64 failed. Http status code is Forbidden.
17:13:15.803  17:13:15.803  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
17:13:15.803  JreResolver: Metadata could not be retrieved.
17:13:15.803  JreResolver: Resolving JRE path. Retrying...
17:13:15.804  Downloading from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64...
17:13:15.959  Response received from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64...
17:13:15.96  Downloading from http://ogl5q.wiremockapi.cloud/analysis/jres?os=windows&arch=x64 failed. Http status code is Forbidden.
17:13:15.96  17:13:15.96  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
17:13:15.961  JreResolver: Metadata could not be retrieved.

Invalid endpoint SC

/d:sonar.scanner.apiBaseUrl=https://myapi.somedomain.it

🟑 Same as for SQ: This shouldn't be re-tried.

17:16:12.899  17:16:12.89  Server Url: https://sonarcloud.io
17:16:12.9  17:16:12.89  Api Url: https://myapi.somedomain.it
17:16:12.9  17:16:12.89  Is SonarCloud: True
...
17:16:13.169  Fetching server version...
17:16:13.172  Downloading from https://myapi.somedomain.it/analysis/version...
17:16:13.238  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/version'.
17:16:13.242  System.Net.WebException: The remote name could not be resolved: 'myapi.somedomain.it'
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
17:16:13.242  Downloading from https://sonarcloud.io/api/server/version...
17:16:13.303  Response received from https://sonarcloud.io/api/server/version...
17:16:13.312  SonarCloud detected, skipping server version check.
17:16:13.312  SonarCloud detected, skipping license check.
17:16:13.314  JreResolver: Resolving JRE path.
17:16:13.321  Downloading from https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64...
17:16:13.323  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64'.
17:16:13.323  System.Net.WebException: The remote name could not be resolved: 'myapi.somedomain.it'
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
17:16:13.324  17:16:13.324  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
17:16:13.324  JreResolver: Metadata could not be retrieved.
17:16:13.324  JreResolver: Resolving JRE path. Retrying...
17:16:13.325  Downloading from https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64...
17:16:13.325  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'https://myapi.somedomain.it/analysis/jres?os=windows&arch=x64'.
17:16:13.325  System.Net.WebException: The remote name could not be resolved: 'myapi.somedomain.it'
   at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar)
17:16:13.326  17:16:13.326  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
17:16:13.326  JreResolver: Metadata could not be retrieved.
gregory-paidis-sonarsource commented 3 months ago

sonar.scanner.javaExePath

Tested on Ubuntu 20.04+SonarCloud, the JRE is downloaded, unzipped, and the permissions are set correctly, after a fix removing a dependency. The end step is using the JAVA_HOME specified by the begin step.

Tested on Ubuntu 20.04+SonarCloud, the JRE is NOT downloaded, and the path specified by the user is respected.

gregory-paidis-sonarsource commented 3 months ago

sonar.scanner.skipJreProvisioning

From the logs on Ubuntu 20.04+SonarCloud:

10:31:23.491  JreResolver: Resolving JRE path.
10:31:23.491  JreResolver: sonar.scanner.skipJreProvisioning is set, skipping JRE provisioning.

and then when dumping the properties file:

sonar.scanner.skipJreProvisioning=true

Running ps aux | grep [j]ava shows the default usr/bin/java:

greg      6131 35.0  0.2 9759784 63848 pts/1   Sl+  10:45   0:00 /usr/bin/java -Djava.awt.headless=true -classpath /mnt/c/dev/sonar/sonar-scanner-msbuild/build/sonarscanner-net/sonar-scanner-5.0.1.3006/lib/sonar-scanner-cli-5.0.1.3006.jar -Dscanner.home=/mnt/c/dev/sonar/sonar-scanner-msbuild/build/sonarscanner-net/sonar-scanner-5.0.1.3006 -Dproject.home=/home/greg/tarz_testing org.sonarsource.scanner.cli.Main -Dsonar.token=<TOKEN> -Dsonar.scanAllFiles=true -Dproject.settings=/home/greg/tarz_testing/.sonarqube/out/sonar-project.properties --from=ScannerMSBuild/7.0 --debug
martin-strecker-sonarsource commented 3 months ago

timeouts

Default timeout: 100 sec

10:23:04.163  JreResolver: Resolving JRE path.
10:23:04.168  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:24:44.194  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:24:44.199  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:24:44.2  10:24:44.2  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:24:44.2  JreResolver: Metadata could not be retrieved.
10:24:44.2  JreResolver: Resolving JRE path. Retrying...
10:24:44.201  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:26:24.208  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:26:24.209  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:26:24.21  10:26:24.21  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:26:24.21  JreResolver: Metadata could not be retrieved.
10:26:24.214  Fetching analysis configuration settings...

sonar.http.timeout valid

🟒 Timeout is respected for the API v2 endpoint:

/d:sonar.http.timeout=5

10:43:05.382  JreResolver: Resolving JRE path.
10:43:05.386  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:43:10.4  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:43:10.404  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:43:10.404  10:43:10.404  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:43:10.404  JreResolver: Metadata could not be retrieved.
10:43:10.404  JreResolver: Resolving JRE path. Retrying...
10:43:10.406  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:43:15.414  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:43:15.415  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:43:15.416  10:43:15.416  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:43:15.417  JreResolver: Metadata could not be retrieved.
10:43:15.42  Fetching analysis configuration settings...

The timeout is also respected by the version 1 endpoint (proxying via /d:sonar.host.url="http://localhost:5080/SonarQube"):

11:27:20.856  11:27:20.829  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
11:27:20.856  11:27:20.844  Server Url: http://localhost:5080/SonarQube
11:27:20.857  11:27:20.844  Api Url: http://localhost:5080/
11:27:20.857  11:27:20.844  Is SonarCloud: False
11:27:20.858  11:27:20.856  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
11:27:20.861  Updating build integration targets...
...
11:27:20.956  Downloading from http://localhost:5080/SonarQube/api/settings/values?component=unknown...
11:27:25.977  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/SonarQube/api/settings/values?component=unknown'.
11:27:25.981  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()

Unhandled Exception: System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<DownloadResource>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.PreprocessorObjectFactory.<CanAuthenticate>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.PreprocessorObjectFactory.<CreateSonarWebServer>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.<DoExecute>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.PreProcessor.<Execute>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.BootstrapperClass.<PreProcess>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.BootstrapperClass.<Execute>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Execute>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Execute>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Main>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.Program.<Main>(String[] args)

The setting is passed to the scanner-cli via the .sonarqube\out\sonar-project.properties file: 🟑 The setting should be mapped to the corresponding property known by the scanner-cli (sonar.scanner.connectTimeout) when we update the cli to version 6. Tracking issue: #2059

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.http.timeout=5

sonar.http.timeout invalid

🟒 A warning about the wrong parameter is given. The timeout is reset to the default 100 sec:

/d:sonar.http.timeout=xx

10:44:34.661  10:44:34.649  Server Url: http://localhost:9000
10:44:34.661  10:44:34.649  Api Url: http://localhost:5080/
10:44:34.662  10:44:34.649  Is SonarCloud: False
10:44:34.662  10:44:34.653  10:44:34.653  WARNING: The specified value `sonar.http.timeout` for `xx` cannot be parsed. The default value of 100s will be used. Please remove the parameter or specify the value in seconds, greater than 0.
10:44:34.663  10:44:34.659  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
...
10:44:34.913  JreResolver: Resolving JRE path.
10:44:34.918  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:46:14.93  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:46:14.934  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:46:14.935  10:46:14.935  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:46:14.935  JreResolver: Metadata could not be retrieved.
10:46:14.935  JreResolver: Resolving JRE path. Retrying...
10:46:14.935  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:47:54.945  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:47:54.946  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:47:54.947  10:47:54.947  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:47:54.947  JreResolver: Metadata could not be retrieved.

The setting is persistent for the scanner-cli:

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.http.timeout=xx

sonar.scanner.connectTimeout valid

🟒 The timeout is respected for the V2 endpoint

/d:sonar.scanner.connectTimeout=5

10:54:07.703  JreResolver: Resolving JRE path.
10:54:07.709  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:54:12.717  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:54:12.721  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:54:12.723  10:54:12.723  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:54:12.723  JreResolver: Metadata could not be retrieved.
10:54:12.723  JreResolver: Resolving JRE path. Retrying...
10:54:12.723  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:54:17.727  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:54:17.728  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:54:17.73  10:54:17.73  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:54:17.73  JreResolver: Metadata could not be retrieved.

The timeout is also used by the V1 endpoint:

...
11:31:39.664  Downloading from http://localhost:5080/SonarQube/api/settings/values?component=unknown...
11:31:44.689  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/SonarQube/api/settings/values?component=unknown'.
11:31:44.693  System.Threading.Tasks.TaskCanceledException: A task was canceled.
...

The setting is passed to the scanner-cli via the .sonarqube\out\sonar-project.properties file:

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.scanner.connectTimeout=5

sonar.scanner.connectTimeout invalid

🟑 A warning is given and the default timeout is used but the end step fails. #2063

/d:sonar.scanner.connectTimeout=xx

10:55:54.674  10:55:54.663  Server Url: http://localhost:9000
10:55:54.674  10:55:54.663  Api Url: http://localhost:5080/
10:55:54.675  10:55:54.663  Is SonarCloud: False
10:55:54.675  10:55:54.667  10:55:54.667  WARNING: The specified value `sonar.scanner.connectTimeout` for `xx` cannot be parsed. The default value of 100s will be used. Please remove the parameter or specify the value in seconds, greater than 0.
10:55:54.675  10:55:54.673  sonar.verbose=true was specified - setting the log verbosity to 'Debug'
...
10:55:54.909  JreResolver: Resolving JRE path.
10:55:54.913  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:57:34.925  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:57:34.93  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:57:34.931  10:57:34.931  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:57:34.931  JreResolver: Metadata could not be retrieved.
10:57:34.932  JreResolver: Resolving JRE path. Retrying...
10:57:34.932  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
10:59:14.943  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/analysis/jres?os=windows&arch=x64'.
10:59:14.943  System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient.<FinishSendAsyncBuffered>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at SonarScanner.MSBuild.PreProcessor.WebClientDownloader.<GetAsync>d__10.MoveNext()
10:59:14.944  10:59:14.944  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=windows&arch=x64.
10:59:14.944  JreResolver: Metadata could not be retrieved.

The parameter is given to the scanner-cli. The embedded version is failing with this message Caused by: java.lang.NumberFormatException: For input string: "xx" deep in a stacktrace.

stack trace
14:25:48.120 INFO: Final Memory: 6M/56M
14:25:48.120 ERROR: Error during SonarScanner execution
14:25:48.120 INFO: ------------------------------------------------------------------------
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginRepository': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:225)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
        at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 28 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 42 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:646)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:626)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 56 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:641)
        ... 70 more
Caused by: java.lang.IllegalArgumentException: sonar.scanner.connectTimeout is not a valid integer: xx
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:108)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseDurationProperty(ScannerWsClientProvider.java:120)
        at org.sonar.scanner.http.ScannerWsClientProvider.provide(ScannerWsClientProvider.java:77)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 71 more
Caused by: java.lang.NumberFormatException: For input string: "xx"
        at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:106)
        ... 78 more
Process returned exit code 1
The SonarScanner did not complete successfully
14:25:48.185  Post-processing failed. Exit code: 1

/d:sonar.http.timeout=5 /d:sonar.scanner.connectTimeout=15

🟑 sonar.http.timeout wins. No warning about sonar.scanner.connectTimeout being ignored. The order of the parameters doesn't matter. #1983

13:13:00.917  Downloading from http://localhost:5080/SonarQube/api/settings/values?component=unknown...
13:13:05.943  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/SonarQube/api/settings/values?component=unknown'.
13:13:05.947  System.Threading.Tasks.TaskCanceledException: A task was canceled.

Both values are persisted for the scanner-cli (see below).

/d:sonar.http.timeout=15 /d:sonar.scanner.connectTimeout=5

🟑 sonar.http.timeout wins. No warning about sonar.scanner.connectTimeout being ignored. The order of the parameters doesn't matter. #1983

13:16:19.186  Downloading from http://localhost:5080/SonarQube/api/settings/values?component=unknown...
13:16:34.213  Unable to connect to server. Please check if the server is running and if the address is correct. Url: 'http://localhost:5080/SonarQube/api/settings/values?component=unknown'.
13:16:34.217  System.Threading.Tasks.TaskCanceledException: A task was canceled.

Both values are persisted for the scanner-cli:

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.http.timeout=15
sonar.scanner.connectTimeout=5

sonar.scanner.socketTimeout valid

🟒 The value is ignored without any warning in the logs. The value is forwarded to the cli:

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.scanner.socketTimeout=5

sonar.scanner.socketTimeout invalid

🟑 The value is ignored without any warning in the logs. The value is forwarded to the cli, but the end step fails with java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx. #2063

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.scanner.socketTimeout=xx
Stacktrace of the end step
14:21:22.759 ERROR: Error during SonarScanner execution
14:21:22.758 INFO: ------------------------------------------------------------------------
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginRepository': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:225)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
        at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 28 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 42 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:646)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:626)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 56 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:641)
        ... 70 more
Caused by: java.lang.IllegalArgumentException: sonar.scanner.socketTimeout is not a valid integer: xx
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:108)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseDurationProperty(ScannerWsClientProvider.java:120)
        at org.sonar.scanner.http.ScannerWsClientProvider.provide(ScannerWsClientProvider.java:76)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 71 more
Caused by: java.lang.NumberFormatException: For input string: "xx"
        at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:106)
        ... 78 more
Process returned exit code 1
The SonarScanner did not complete successfully
14:21:22.828  Post-processing failed. Exit code: 1

sonar.scanner.responseTimeout valid

🟒 The value is ignored without any warning in the logs. The value is forwarded to the cli:

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.scanner.socketTimeout=5

sonar.scanner.responseTimeout invalid

🟑 The value is ignored without any warning in the logs. The value is forwarded to the cli. The end step fails #2063

sonar.host.url=http://localhost:5080/SonarQube
sonar.scanner.apiBaseUrl=http://localhost:5080/
sonar.scanner.socketTimeout=xx
End step logs
14:34:57.307 ERROR: Error during SonarScanner execution
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginRepository': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
14:34:57.307 INFO: ------------------------------------------------------------------------
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
        at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:225)
        at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:205)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
        at jdk.proxy1/jdk.proxy1.$Proxy0.execute(Unknown Source)
        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:126)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
        at org.sonarsource.scanner.cli.Main.main(Main.java:62)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.ScannerPluginInstaller': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 28 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.sonarsource.scanner.api.internal.IsolatedClassloader@768b970c-org.sonar.scanner.bootstrap.PluginFiles': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:794)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:220)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 42 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'DefaultScannerWsClient' defined in org.sonar.scanner.http.ScannerWsClientProvider: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:646)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:626)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:209)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:904)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781)
        ... 56 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.sonar.scanner.http.DefaultScannerWsClient]: Factory method 'provide' threw exception; nested exception is java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:641)
        ... 70 more
Caused by: java.lang.IllegalArgumentException: sonar.scanner.responseTimeout is not a valid integer: xx
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:108)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseDurationProperty(ScannerWsClientProvider.java:120)
        at org.sonar.scanner.http.ScannerWsClientProvider.provide(ScannerWsClientProvider.java:78)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 71 more
Caused by: java.lang.NumberFormatException: For input string: "xx"
        at java.base/java.lang.NumberFormatException.forInputString(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at java.base/java.lang.Integer.parseInt(Unknown Source)
        at org.sonar.scanner.http.ScannerWsClientProvider.parseIntProperty(ScannerWsClientProvider.java:106)
        ... 78 more
Process returned exit code 1
The SonarScanner did not complete successfully
14:34:57.378  Post-processing failed. Exit code: 1
gregory-paidis-sonarsource commented 3 months ago

Make sure permissions are respected on linux:

Tested on Ubuntu 20.04, seems to work:

greg@PC-L0117:~/tarz_testing$ l  ~/.sonar/cache/bcb1b7b8ad68c93093f09b591b7cb17161d39891f7d29d33a586f5a328603707/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.
tar.gz_extracted/jdk-17.0.11+9-jre/
total 24K
drwxr-xr-x  2 greg greg 4.0K Jul 16 10:25 bin/
drwxr-xr-x  5 greg greg 4.0K Jul 16 10:25 conf/
drwxr-xr-x 52 greg greg 4.0K Jul 16 10:25 legal/
drwxr-xr-x  5 greg greg 4.0K Jul 16 10:25 lib/
-rw-r--r--  1 greg greg 2.4K Jul 16 10:25 NOTICE
-rw-r--r--  1 greg greg 1.6K Jul 16 10:25 release
greg@PC-L0117:~/tarz_testing$ l  ~/.sonar/cache/bcb1b7b8ad68c93093f09b591b7cb17161d39891f7d29d33a586f5a328603707/OpenJDK17U-jre_x64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin
total 80K
-rwxr-xr-x 1 greg greg 16K Jul 16 10:25 java*
-rwxr-xr-x 1 greg greg 16K Jul 16 10:25 jfr*
-rwxr-xr-x 1 greg greg 16K Jul 16 10:25 jrunscript*
-rwxr-xr-x 1 greg greg 16K Jul 16 10:25 keytool*
-rwxr-xr-x 1 greg greg 16K Jul 16 10:25 rmiregistry*
gregory-paidis-sonarsource commented 3 months ago

Setting sonar.scanner.os to a value outside of the list

Running the scanner with d:sonar.scanner.os=lunix yields:

11:14:38.703  JreResolver: Resolving JRE path.
11:14:38.719  Downloading from https://api.sonarcloud.io/analysis/jres?os=lunix&arch=x64...
11:14:38.863  Response received from https://api.sonarcloud.io/analysis/jres?os=lunix&arch=x64...
11:14:38.906  11:14:38.906  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=lunix&arch=x64.
11:14:38.906  JreResolver: Metadata could not be retrieved.
11:14:38.906  JreResolver: Resolving JRE path. Retrying...
11:14:38.906  Downloading from https://api.sonarcloud.io/analysis/jres?os=lunix&arch=x64...
11:14:39.102  Response received from https://api.sonarcloud.io/analysis/jres?os=lunix&arch=x64...
11:14:39.102  11:14:39.102  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=lunix&arch=x64.
11:14:39.102  JreResolver: Metadata could not be retrieved.
11:14:39.103  Fetching analysis configuration settings...

...and then the default JRE is used.

gregory-paidis-sonarsource commented 3 months ago

Setting sonar.sanner.os to a value inside the list

Running the scanner on Ubuntu 20.04 and setting sonar.scanner.os=macos yields:

11:16:36.419  JreResolver: Resolving JRE path.
11:16:36.435  Downloading from https://api.sonarcloud.io/analysis/jres?os=macos&arch=x64...
11:16:36.583  Response received from https://api.sonarcloud.io/analysis/jres?os=macos&arch=x64...
11:16:36.635  JreResolver: Cache miss. Attempting to download JRE.
11:16:36.638  Starting the Java Runtime Environment download.
11:16:36.639  Downloading Java JRE from https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz.
11:16:44.37  The checksum of the downloaded file is '232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0' and the expected checksum is '232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0'.
11:16:44.371  Starting extracting the Java runtime environment from archive '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz' to folder '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/qxpnyxyd.jqr'.
11:16:45.636  Moving extracted Java runtime environment from '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/qxpnyxyd.jqr' to '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz_extracted'.
11:16:45.636  The Java runtime environment was successfully added to '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz_extracted'.
11:16:45.637  JreResolver: Download success. JRE can be found at '/home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home/bin/java'.
11:16:45.638  Fetching analysis configuration settings...

...then on the properties file we can see:

sonar.scanner.os=macos

and in the end step:

Setting the JAVA_HOME for the scanner cli to /home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home.
Calling the SonarScanner CLI...
Setting environment variable 'JAVA_HOME'. Value: /home/greg/.sonar/cache/232c40bebd6ddbb673862e86e7e6e09bcfe399e5a53c8a6b77bf1ceab8edefd0/OpenJDK17U-jre_x64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home

..and it fails, which is normal as the java binary is for a different OS:

Executing file /mnt/c/dev/sonar/sonar-scanner-msbuild/build/sonarscanner-net/sonar-scanner-5.0.1.3006/bin/sonar-scanner
  Args: -Dsonar.scanAllFiles=true -Dproject.settings=/home/greg/tarz_testing/.sonarqube/out/sonar-project.properties --from=ScannerMSBuild/7.0 --debug <sensitive data removed>
  Working directory: /home/greg/tarz_testing
  Timeout (ms):-1
  Process id: 11003
Process returned exit code 2
gregory-paidis-sonarsource commented 3 months ago

Manually setting sonar.scanner.arch

Setting sonar.scanner.arch to aarch64 yields on Ubuntu 20.04 x64:

11:21:23.94  JreResolver: Resolving JRE path.
11:21:23.956  Downloading from https://api.sonarcloud.io/analysis/jres?os=linux&arch=aarch64...
11:21:24.116  Response received from https://api.sonarcloud.io/analysis/jres?os=linux&arch=aarch64...
11:21:24.165  JreResolver: Cache miss. Attempting to download JRE.
11:21:24.167  Starting the Java Runtime Environment download.
11:21:24.168  Downloading Java JRE from https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz.
11:21:32.131  The checksum of the downloaded file is 'ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16' and the expected checksum is 'ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16'.
11:21:32.132  Starting extracting the Java runtime environment from archive '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz' to folder '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/pb5zkq0r.m30'.
11:21:33.212  Moving extracted Java runtime environment from '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/pb5zkq0r.m30' to '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz_extracted'.
11:21:33.212  The Java runtime environment was successfully added to '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz_extracted'.
11:21:33.213  JreResolver: Download success. JRE can be found at '/home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin/java'.
11:21:33.214  Fetching analysis configuration settings...

and in the properties file:

sonar.scanner.arch=aarch64

and in the end step:

Setting the JAVA_HOME for the scanner cli to /home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre.
Calling the SonarScanner CLI...
Setting environment variable 'JAVA_HOME'. Value: /home/greg/.sonar/cache/ccfa23c25790475c84df983cc5f729b94c04d9ea9863912deb15c6266782cf16/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre

setting sonar.scanner.arch to an invalid value

11:26:36.639  JreResolver: Resolving JRE path.
11:26:36.655  Downloading from https://api.sonarcloud.io/analysis/jres?os=linux&arch=myArch...
11:26:36.817  Response received from https://api.sonarcloud.io/analysis/jres?os=linux&arch=myArch...
11:26:36.859  11:26:36.859  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=linux&arch=myArch.
11:26:36.859  JreResolver: Metadata could not be retrieved.
11:26:36.859  JreResolver: Resolving JRE path. Retrying...
11:26:36.859  Downloading from https://api.sonarcloud.io/analysis/jres?os=linux&arch=myArch...
11:26:37.981  Response received from https://api.sonarcloud.io/analysis/jres?os=linux&arch=myArch...
11:26:37.982  11:26:37.982  WARNING: JRE Metadata could not be retrieved from analysis/jres?os=linux&arch=myArch.
11:26:37.982  JreResolver: Metadata could not be retrieved.
11:26:37.983  Fetching analysis configuration settings..
gregory-paidis-sonarsource commented 3 months ago

alpine testing

Run an alpine container via wsl Ubuntu 20.04.

# Use an official Alpine as a base image
FROM alpine:latest

# Define a build-time variable with a default value
ARG DOTNET_VERSION=7.0.306

# Install dependencies and .NET SDK
RUN apk update && \
    apk add --no-cache bash curl icu-libs && \
    wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh && \
    chmod +x dotnet-install.sh && \
    ./dotnet-install.sh --version $DOTNET_VERSION --install-dir /usr/share/dotnet && \
    ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet

# Set the working directory
WORKDIR /app

# Copy the repository files into the container (assuming the repository is in the current directory)
COPY . .

# Verify the .NET installation
RUN dotnet --version

# Default command
CMD ["sh"]
11:35:36.021  JreResolver: Resolving JRE path.
11:35:36.023  Downloading from https://api.sonarcloud.io/analysis/jres?os=alpine&arch=x64...
11:35:36.179  Response received from https://api.sonarcloud.io/analysis/jres?os=alpine&arch=x64...
11:35:36.272  JreResolver: Cache miss. Attempting to download JRE.
11:35:36.275  Starting the Java Runtime Environment download.
11:35:36.276  Downloading Java JRE from https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.11_9.tar.gz.
11:35:44.736  The checksum of the downloaded file is 'b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8' and the expected checksum is 'b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8'.
11:35:44.738  Starting extracting the Java runtime environment from archive '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.11_9.tar.gz' to folder '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/imoxbh3e.yak'.
11:35:46.02  Moving extracted Java runtime environment from '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/imoxbh3e.yak' to '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.11_9.tar.gz_extracted'.
11:35:46.021  The Java runtime environment was successfully added to '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.11_9.tar.gz_extracted'.
11:35:46.022  JreResolver: Download success. JRE can be found at '/root/.sonar/cache/b5dffd0be08c464d9c3903e2947508c1a5c21804ea1cff5556991a2a47d617d8/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/bin/java'.
11:35:46.024  Fetching analysis configuration settings...

Result was successful.

gregory-paidis-sonarsource commented 3 months ago

Testing on Macbook M1

14:39:35.553 The checksum of the downloaded file is '003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660' and the expected checksum is '003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660'. 14:39:35.554 Starting extracting the Java runtime environment from archive '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz' to folder '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/2s4rtlen.te3'. 14:39:43.299 Moving extracted Java runtime environment from '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/2s4rtlen.te3' to '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted'. 14:39:43.3 The Java runtime environment was successfully added to '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted'. 14:39:43.3 JreResolver: Download success. JRE can be found at '/Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home/bin/java'. 14:39:43.303 Fetching analysis configuration settings...


- the filesystem

gregory.pedis@MAC-L0024 TestingAlpine % ls -la /Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home/bin total 720 drwxr-xr-x 7 root staff 224 Jul 16 14:39 . drwxr-xr-x 8 root staff 256 Jul 16 14:39 .. -rwxr-xr-x 1 root staff 70464 Jul 16 14:39 java -rwxr-xr-x 1 root staff 70448 Jul 16 14:39 jfr -rwxr-xr-x 1 root staff 70464 Jul 16 14:39 jrunscript -rwxr-xr-x 1 root staff 70464 Jul 16 14:39 keytool -rwxr-xr-x 1 root staff 70464 Jul 16 14:39 rmiregistry


- end step

4:53:59.786 Writing processing summary to /Users/gregory.pedis/TestingAlpine/.sonarqube/out/ProjectInfo.log Setting the JAVA_HOME for the scanner cli to /Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home. Calling the SonarScanner CLI... Setting environment variable 'JAVA_HOME'. Value: /Users/gregory.pedis/.sonar/cache/003d3e0a65a2f0633b8bfed42be133724b490acb323c174c708d3a446d5fc660/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.11_9.tar.gz_extracted/jdk-17.0.11+9-jre/Contents/Home Executing file /Users/gregory.pedis/TestingAlpine/sonarscanner-net/sonar-scanner-5.0.1.3006/bin/sonar-scanner

martin-strecker-sonarsource commented 3 months ago

The error log for a failed JRE download (e.g., 404) contains an NRE. I created issue #2060 to fix this.

martin-strecker-sonarsource commented 3 months ago

sonar.userHome

/d:sonar.userHome="E:\UserHome"

🟑 The directory is created and used for the JRE cache and the CLI. The directory isn't used for other caches. See #2061

19:40:52.98  JreResolver: Resolving JRE path.
19:40:52.987  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
19:40:54.007  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
19:40:54.033  JreResolver: Cache miss. Attempting to download JRE.
19:40:54.044  Starting the Java Runtime Environment download.
19:40:54.047  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
19:40:54.049  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:40:54.06  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:40:54.066  The checksum of the downloaded file is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' and the expected checksum is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f'.
19:40:54.069  Starting extracting the Java runtime environment from archive 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\2s2ldw5l.dcg'.
19:40:54.113  Moving extracted Java runtime environment from 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\2s2ldw5l.dcg' to 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted'.
19:40:54.115  The Java runtime environment was successfully added to 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted'.
19:40:54.116  JreResolver: Download success. JRE can be found at 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
19:40:54.122  Fetching analysis configuration settings...

end step

9:50:58.579 DEBUG: Create: E:\UserHome\cache
19:50:58.580 INFO: User cache: E:\UserHome\cache
19:50:58.580 DEBUG: Create: E:\UserHome\cache\_tmp
19:50:58.585 DEBUG: Extract sonar-scanner-api-batch in temp...
19:50:58.598 DEBUG: Get bootstrap index...
19:50:58.598 DEBUG: Download: http://localhost:5080/SonarQube/batch/index
19:50:59.753 DEBUG: Get bootstrap completed
19:50:59.759 DEBUG: Download http://localhost:5080/SonarQube/batch/file?name=scanner-developer-10.7.0.92547-all.jar to E:\UserHome\cache\_tmp\fileCache14667252277309585008.tmp

Invalid directory

🟒 The begin step fails early

20:36:33.312  20:36:33.299  Loading analysis properties from E:\sonarscanner-net-framework\SonarQube.Analysis.xml
20:36:33.313  20:36:33.309  Server Url: http://localhost:5080/SonarQube
20:36:33.313  20:36:33.309  Api Url: http://localhost:5080/
20:36:33.313  20:36:33.309  Is SonarCloud: False
20:36:33.314  20:36:33.312  The attempt to create the directory specified by 'sonar.userHome' at 'X:\UserHome' failed with error 'Could not find a part of the path 'X:\UserHome'.'. Provide a valid path for 'sonar.userHome' to a directory that can be created.
20:36:33.315  Expecting at least the following command line argument:
- SonarQube/SonarCloud project key
The full path to a settings file can also be supplied. If it is not supplied, the exe will attempt to locate a default settings file in the same directory as the SonarQube Scanner for MSBuild.
Use '/?' or '/h' to see the help message.
20:36:33.315  Pre-processing failed. Exit code: 1

Write protected cache folder

🟒 The JRE provisioning fails if UserHome is not writeable.

20:46:40.335  JreResolver: Resolving JRE path.
20:46:40.343  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
20:46:41.385  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
20:46:41.415  JreResolver: Cache miss. Attempting to download JRE.
20:46:41.42  JreResolver: Download failure. The Java runtime environment cache directory in 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' could not be created.
20:46:41.42  JreResolver: Resolving JRE path. Retrying...
20:46:41.421  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
20:46:42.445  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
20:46:42.446  JreResolver: Cache miss. Attempting to download JRE.
20:46:42.446  JreResolver: Download failure. The Java runtime environment cache directory in 'E:\UserHome\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' could not be created.
20:46:42.45  Fetching analysis configuration settings...
martin-strecker-sonarsource commented 3 months ago

Checksum validation

🟒 A failed checksum validation results in a retry and fails after the retry.

19:33:27.944  Starting the Java Runtime Environment download.
19:33:27.954  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
19:33:27.961  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:33:28.062  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:33:28.078  The checksum of the downloaded file is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' and the expected checksum is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe'.
19:33:28.081  Deleting file 'E:\UserHome\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\0rdgv0r3.1op'.
19:33:28.085  The download of the Java runtime environment from the server failed with the exception 'The checksum of the downloaded Java runtime environment does not match the expected checksum.'.
19:33:28.087  JreResolver: Download failure. The download of the Java runtime environment from the server failed with the exception 'The checksum of the downloaded Java runtime environment does not match the expected checksum.'.
19:33:28.089  JreResolver: Resolving JRE path. Retrying...
19:33:28.09  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
19:33:29.126  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
19:33:29.129  JreResolver: Cache miss. Attempting to download JRE.
19:33:29.13  Starting the Java Runtime Environment download.
19:33:29.135  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
19:33:29.137  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:33:29.158  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
19:33:29.164  The checksum of the downloaded file is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' and the expected checksum is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe'.
19:33:29.166  Deleting file 'E:\UserHome\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\1pia2lv2.tua'.
19:33:29.169  The download of the Java runtime environment from the server failed with the exception 'The checksum of the downloaded Java runtime environment does not match the expected checksum.'.
19:33:29.17  JreResolver: Download failure. The download of the Java runtime environment from the server failed with the exception 'The checksum of the downloaded Java runtime environment does not match the expected checksum.'.
19:33:29.184  Fetching analysis configuration settings...
gregory-paidis-sonarsource commented 3 months ago

javaExePath specified to a file that does not exist

We log an error and exit early:

11:11:54.88  11:11:54.879  The argument 'sonar.scanner.javaExePath' contains an invalid path. Please make sure the path is correctly pointing to the java executable.

javaExePath specified to an existing file that cannot be executed

Begin step succeeds without provisioning:

11:16:01.089  JreResolver: Resolving JRE path.
11:16:01.089  JreResolver: sonar.scanner.javaExePath is set, skipping JRE provisioning.

End step fails as follows:

Calling the SonarScanner CLI...
Could not find 'java' executable in JAVA_HOME or PATH.
gregory-paidis-sonarsource commented 3 months ago

JRE provisioning skipped and there is no JRE installed

End step fails as expected:

09:29:12.596  Writing processing summary to /trash/.sonarqube/out/ProjectInfo.log
Calling the SonarScanner CLI...
Executing file /sonarscanner-net/sonar-scanner-5.0.1.3006/bin/sonar-scanner
  Args: -Dsonar.scanAllFiles=true -Dproject.settings=/trash/.sonarqube/out/sonar-project.properties --from=ScannerMSBuild/7.0 --debug <sensitive data removed>
  Working directory: /trash
  Timeout (ms):-1
  Process id: 1069
Could not find 'java' executable in JAVA_HOME or PATH.
Process returned exit code 1
martin-strecker-sonarsource commented 3 months ago

Authentication header

πŸ”΄ From the spec:

When downloading resources (JRE, scanner engine, …), special care should be taken not to leak the token to a third-party endpoint. If the downloadUrl starts with the same path as sonar.host.url or sonar.scanner.apiBaseUrl, then the token should be passed. Otherwise, we assume there is no authentication required.

Source

Tracking issue: #2066

Download URL starts with the sonar.scanner.apiBaseUrl path

πŸ”΄ Bearer token is missing.

/d:sonar.scanner.sonarcloudUrl="http://localhost:5080/SonarCloud" /d:sonar.scanner.apiBaseUrl="http://localhost:5080"

Stubbed API is configured to return downloadUrl = "http://localhost:5080/download", in the JRE JSON

11:46:07.095  Downloading Java JRE from http://localhost:5080/download.

The bearer token is missing in the request (see the missing "Authorization: [Redacted]" entry in the log:

info: Microsoft.AspNetCore.HttpLogging.HttpLoggingMiddleware[1]
      Request:
      Protocol: HTTP/1.1
      Method: GET
      Scheme: http
      PathBase:
      Path: /download
      Host: localhost:5080

Sonar Qube

🟒 The download URL is ignored and the bearer token is sent:

image

martin-strecker-sonarsource commented 3 months ago

JRE installation is corrupted

JRE in cache is corrupted

🟑 If java.exe is not in the cache, but the sha256 directory exists, then the JRE provisioning fails without attempting to re-download the JRE. We do have a re-try, that shouldn't be there in this case.

14:22:47.854  JreResolver: Resolving JRE path.
14:22:47.858  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:22:50.319  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:22:50.337  JreResolver: Cache failure. The java executable in the Java runtime environment cache could not be found at the expected location 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
14:22:50.338  JreResolver: Resolving JRE path. Retrying...
14:22:50.338  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:22:52.468  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:22:52.469  JreResolver: Cache failure. The java executable in the Java runtime environment cache could not be found at the expected location 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
14:22:52.473  Fetching analysis configuration settings...

Downloaded JRE is corrupted

🟑 The file is searched before the rename of the temp folder and the temp folder is deleted. The downloaded zip file is kept. We do a second attempt but we reuse the same zip file.

14:14:33.604  JreResolver: Resolving JRE path.
14:14:33.609  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:14:36.234  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:14:36.253  JreResolver: Cache miss. Attempting to download JRE.
14:14:36.26  Starting the Java Runtime Environment download.
14:14:36.262  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
14:14:36.263  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
14:14:36.272  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
14:14:36.277  The checksum of the downloaded file is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' and the expected checksum is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f'.
14:14:36.28  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\lmnmyjr3.guw'.
14:14:36.309  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\lmnmyjr3.guw\jdk-17.0.11+9-jre/bin/java_notThere.exe' but couldn't be found.'.
14:14:36.312  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
14:14:36.312  JreResolver: Resolving JRE path. Retrying...
14:14:36.313  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:14:38.467  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
14:14:38.468  JreResolver: Cache miss. Attempting to download JRE.
14:14:38.468  The Java Runtime Environment was already downloaded from the server and stored at 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip'.
14:14:38.47  The checksum of the downloaded file is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f' and the expected checksum is 'd3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f'.
14:14:38.471  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\0pgorkm2.p5u'.
14:14:38.474  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\.sonar\cache\d3bee954a2eabbe9ad76cdc22a1cfefb5236e7fe875bd0336320de49472ddc6f\0pgorkm2.p5u\jdk-17.0.11+9-jre/bin/java_notThere.exe' but couldn't be found.'.
14:14:38.476  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
14:14:38.481  Fetching analysis configuration settings...
gregory-paidis-sonarsource commented 3 months ago

Parallel execution with another scanner (e.g. CLI) -> each scanner will download the JRE, will unpack on separate folders and try to rename. The scanner should handle the case when renaming fails but provisioning succeeds.

I run this script:

echo "cleaning cache"
echo "==========="
rm -r C:\Users\gregory.pedis\.sonar\cache\

echo "running begin steps"
echo "==========="

$total = 5

$scriptBlock = {
    param ($i)
    dotnet C:\dev\sonar\sonar-scanner-msbuild\build\sonarscanner-net\SonarScanner.MSBuild.dll begin /o:"greggy42" /k:"greggy42_testing-jre" `
    /d:sonar.host.url="https://sonarcloud.io" `
    /d:sonar.token="NOPE" /d:sonar.verbose=true
}

$jobs = @()
for ($i = 1; $i -le $total; $i++) {
    $jobs += Start-Job -ScriptBlock $scriptBlock -ArgumentList $i
}

echo "waiting to finish"
echo "==========="
$jobs | ForEach-Object { $_ | Wait-Job }

echo "writing results"
echo "==========="
$i = 1
$jobs | ForEach-Object {
    $jobResult = Receive-Job -Job $_
    Write-Output $jobResult > "logs$i"
    $i++
}

One of the jobs successfully downloaded first the JRE:

14:31:07.333  JreResolver: Resolving JRE path.
14:31:07.335  Downloading from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:31:07.494  Response received from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:31:07.554  JreResolver: Cache miss. Attempting to download JRE.
14:31:07.556  Starting the Java Runtime Environment download.
14:31:07.557  Downloading Java JRE from https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip.
14:32:27.283  The checksum of the downloaded file is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe' and the expected checksum is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe'.
14:32:27.285  Starting extracting the Java runtime environment from archive 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\hmoy3jas.hra'.
14:32:28.143  Moving extracted Java runtime environment from 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\hmoy3jas.hra' to 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted'.
14:32:28.145  The Java runtime environment was successfully added to 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted'.
14:32:28.145  JreResolver: Download success. JRE can be found at 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
14:32:28.148  Fetching analysis configuration settings...

...and the rest tried to extract but failed, and fell back to a cache hit:

14:31:08.594  JreResolver: Resolving JRE path.
14:31:08.597  Downloading from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:31:08.86  Response received from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:31:08.913  JreResolver: Cache miss. Attempting to download JRE.
14:31:08.915  Starting the Java Runtime Environment download.
14:31:08.917  Downloading Java JRE from https://scanner.sonarcloud.io/jres/OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip.
14:32:29.087  The checksum of the downloaded file is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe' and the expected checksum is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe'.
14:32:29.088  Deleting file 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\nexbydhr.0r4'.
14:32:29.093  The download of the Java runtime environment from the server failed with the exception 'Cannot create a file when that file already exists.'.
14:32:29.093  The Java Runtime Environment archive was found after the download failed. Another scanner did the download in the parallel.
14:32:29.15  The checksum of the downloaded file is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe' and the expected checksum is '4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe'.
14:32:29.151  Starting extracting the Java runtime environment from archive 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\b0xaldgo.hxa'.
14:32:30.096  Moving extracted Java runtime environment from 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\b0xaldgo.hxa' to 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted'.
14:32:30.097  The extraction of the downloaded Java runtime environment failed with error 'Cannot create 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted' because a file or directory with the same name already exists.'.
14:32:30.26  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
14:32:30.26  JreResolver: Resolving JRE path. Retrying...
14:32:30.261  Downloading from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:32:30.458  Response received from https://api.sonarcloud.io/analysis/jres?os=windows&arch=x64...
14:32:30.458  JreResolver: Cache hit 'C:\Users\gregory.pedis\.sonar\cache\4bafe2e94439c8193fc8c68247cb0dbaf4e80265b903288f63f128304f129bbe\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip_extracted\jdk-17.0.11+9-jre/bin/java.exe'.
14:32:30.461  Fetching analysis configuration settings...
martin-strecker-sonarsource commented 3 months ago

Disk full

Disk full on download

🟒 The download fails and the temp download file is deleted. The sha265 directory is kept. A re-try is done and fails the same way. The next scanner run also works as expected (download) and the existing (empty) sha265 directory is not a problem.

15:18:12.177  JreResolver: Resolving JRE path.
15:18:12.181  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:18:13.192  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:18:13.212  JreResolver: Cache miss. Attempting to download JRE.
15:18:13.22  Starting the Java Runtime Environment download.
15:18:13.222  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
15:18:13.225  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:18:14.893  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:18:14.896  Deleting file 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\a1bg4ufg.nlw'.
15:18:14.897  The download of the Java runtime environment from the server failed with the exception 'There is not enough space on the disk.
'.
15:18:14.898  JreResolver: Download failure. The download of the Java runtime environment from the server failed with the exception 'There is not enough space on the disk.
'.
15:18:14.898  JreResolver: Resolving JRE path. Retrying...
15:18:14.899  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:18:15.91  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:18:15.91  JreResolver: Cache miss. Attempting to download JRE.
15:18:15.911  Starting the Java Runtime Environment download.
15:18:15.912  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
15:18:15.912  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:18:17.652  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:18:17.653  Deleting file 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\fohbo2nr.qjs'.
15:18:17.654  The download of the Java runtime environment from the server failed with the exception 'There is not enough space on the disk.
'.
15:18:17.655  JreResolver: Download failure. The download of the Java runtime environment from the server failed with the exception 'There is not enough space on the disk.
'.
15:18:17.66  Fetching analysis configuration settings...

Disk full on extraction

🟑 The JRE provisioning failed as expected. The temp extraction folder is deleted after the extraction failed. The zip file is kept. A retry is attempted without downloading again. That retry is questionable.

15:12:41.161  JreResolver: Cache miss. Attempting to download JRE.
15:12:41.167  Starting the Java Runtime Environment download.
15:12:41.169  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
15:12:41.17  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:12:42.918  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
15:12:43.021  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
15:12:43.024  Starting extracting the Java runtime environment from archive 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\w4am0sg4.ekh'.
15:12:43.826  The extraction of the downloaded Java runtime environment failed with error 'There is not enough space on the disk.
'.
15:12:43.9  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
15:12:43.901  JreResolver: Resolving JRE path. Retrying...
15:12:43.902  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:12:44.915  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
15:12:44.915  JreResolver: Cache miss. Attempting to download JRE.
15:12:44.916  The Java Runtime Environment was already downloaded from the server and stored at 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip'.
15:12:44.975  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
15:12:44.976  Starting extracting the Java runtime environment from archive 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'E:\UserHome\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\vhju3ws0.fsi'.
15:12:45.68  The extraction of the downloaded Java runtime environment failed with error 'There is not enough space on the disk.
'.
15:12:45.745  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
15:12:45.751  Fetching analysis configuration settings...
martin-strecker-sonarsource commented 3 months ago

Path to long

On extraction

🟑 The extraction fails and the temp dir is deleted. The zip files stays and a retry is attempted on the zip file. The root cause (Path to long) is swallowed and not given in the error message.

17:02:37.615  JreResolver: Resolving JRE path.
17:02:37.618  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:02:38.627  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:02:38.643  JreResolver: Cache miss. Attempting to download JRE.
17:02:38.65  Starting the Java Runtime Environment download.
17:02:38.652  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
17:02:38.653  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
17:02:39.1  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
17:02:39.233  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
17:02:39.236  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\c5cgoke3.tg4'.
17:02:41.056  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\c5cgoke3.tg4\jdk-17.0.11+9-jre/bin/java.exe' but couldn't be found.'.
17:02:41.234  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
17:02:41.235  JreResolver: Resolving JRE path. Retrying...
17:02:41.236  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:02:42.251  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:02:42.253  JreResolver: Cache miss. Attempting to download JRE.
17:02:42.254  The Java Runtime Environment was already downloaded from the server and stored at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip'.
17:02:42.317  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
17:02:42.318  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\jng2dcmi.xjt'.
17:02:44.173  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLong\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\jng2dcmi.xjt\jdk-17.0.11+9-jre/bin/java.exe' but couldn't be found.'.
17:02:44.358  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
17:02:44.365  Fetching analysis configuration settings...

Path to long on download

The same as above. The download does not fail. It is the extraction that fails.

17:08:28.228  JreResolver: Resolving JRE path.
17:08:28.231  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:08:29.241  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:08:29.26  JreResolver: Cache miss. Attempting to download JRE.
17:08:29.268  Starting the Java Runtime Environment download.
17:08:29.271  Downloading Java JRE from analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961.
17:08:29.273  Downloading from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
17:08:29.599  Response received from http://localhost:5080/analysis/jres/29a1a704-026c-4c58-9b81-ae9bc0ab2961...
17:08:29.74  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
17:08:29.744  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\njqg3m3j.co2'.
17:08:31.995  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\njqg3m3j.co2\jdk-17.0.11+9-jre/bin/java.exe' but couldn't be found.'.
17:08:32.205  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
17:08:32.206  JreResolver: Resolving JRE path. Retrying...
17:08:32.207  Downloading from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:08:33.22  Response received from http://localhost:5080/analysis/jres?os=windows&arch=x64...
17:08:33.221  JreResolver: Cache miss. Attempting to download JRE.
17:08:33.221  The Java Runtime Environment was already downloaded from the server and stored at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip'.
17:08:33.285  The checksum of the downloaded file is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f' and the expected checksum is '1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f'.
17:08:33.286  Starting extracting the Java runtime environment from archive 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\OpenJDK17U-jre_x64_windows_hotspot_17.0.11_9.zip' to folder 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\rq0ljwef.4xy'.
17:08:35.199  The extraction of the downloaded Java runtime environment failed with error 'The java executable in the extracted Java runtime environment was expected to be at 'C:\Users\martin.strecker\AppData\Local\Temp\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\LongNameLongNameLongNameLongNameLongNameLongNameLongNameLongName\cache\1c518fdefd1e6507475f92a0afec3720ceac9a79756773a14b461737dea0ab0f\rq0ljwef.4xy\jdk-17.0.11+9-jre/bin/java.exe' but couldn't be found.'.
17:08:35.385  JreResolver: Download failure. The downloaded Java runtime environment could not be extracted.
17:08:35.391  Fetching analysis configuration settings...