Hi, i am having this issue. On my VM(dynamically deployed Windows Jenkins Node to Azure) i need have older version of Java (jdk-8u131). This version is no longer supported. Therefore i am trying to install newer Java before SonarScan and MSBuild is executed, but for whatever reason Sonar pick up always the older one. Example of Pipeline:
That’s what I get for skimming. I see you made that clear in your OP. I’ve added the dotnet tag to this to draw the attention of the folks who are actually competent to speak in this area.
Thanks.
So nobody any idea how to set JAVA for SonarScanner.MSBuild.exe?
Few more log from our build process.:
[Pipeline] tool (hide)
Unpacking https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/5.0.4.24009/sonar-scanner-msbuild-5.0.4.24009-net46.zip to c:\jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScannerFW4.6MS410 on vm-build35b4c0
[Pipeline] }10:11:06 XXX@vm-build35b4c0 c:\jenkins\workspace\ine_topic-XXX-integration-YYY\src>cmd.exe /C T:\Build\Jenkins\MSBuild\2_PerformBuild.bat
10:11:06 ++SonarQube enabled during the build++
10:11:06 "c:\jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScannerFW4.6MS410\**SonarScanner.MSBuild.exe" begin** /k:XXXXXX /o:oneidentity /d:"sonar.branch.name=topic-XXX-integration-YYY" /d:sonar.showProfiling=true /d:sonar.log.level=TRACE /d:sonar.skipPackageDesign=true /d:"sonar.login=******" /d:"sonar.exclusions=**/*.g.cs,**/*.resx,**/*json,**/*js,**/*xml,**/*tpl,**/*srt,**/*cbt,**/*loc,**/*cfg,**/*snippet,**/*tss,**/*ico,**/*png,**/*sql,**/*.Designer.cs,**/_AutoGenerated/**,**/DataHub/**,**/escrow/**" /d:sonar.c.file.suffixes=- /d:sonar.cpp.file.suffixes=- /d:sonar.objc.file.suffixes=- /d:sonar.cs.vstest.reportsPaths=\**\*.trx /d:sonar.cs.vscoveragexml.reportsPaths=\**\*.coveragexml
10:11:06 SonarScanner for MSBuild 5.0.4
10:11:06 Using the .NET Framework version of the Scanner for MSBuild
10:11:06 Pre-processing started.
10:11:06 Preparing working directories...
10:11:06 09:11:06.489 Updating build integration targets...
10:11:07 09:11:07.269 Fetching analysis configuration settings...
10:11:08 09:11:08.744 Provisioning analyzer assemblies for cs...
10:11:08 09:11:08.747 Installing required Roslyn analyzers...
10:11:11 09:11:10.881 Provisioning analyzer assemblies for vbnet...
10:11:11 09:11:10.881 Installing required Roslyn analyzers...
10:11:11 09:11:10.936 Pre-processing succeeded.
10:11:11 "T:\_Tools\run_msbuild.cmd" -maxCpuCount -nologo -verbosity:m -ds "-p:BuildPlatform=x64;BuildConfiguration=Release;PatchNum=0;BuildNum=244;BetaExpiration=30;SpecialBuild=topic-XXX-integration-YYY.244;TestPlatform=x86" "T:\Build\Jenkins\MSBuild\Build.msbuild" "/p:reportanalyzer=true" "/bl:out.binlog"
10:11:11 C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\**MSBuild.exe** -ds -nologo -maxCpuCount -p:BuildPlatform=x64;BuildConfiguration=Release;PatchNum=0;BuildNum=244;BetaExpiration=30;SpecialBuild=topic-XXX-integration-YYY.244;TestPlatform=x86 /p:reportanalyzer=true -verbosity:m /bl:out.binlog T:\Build\Jenkins\MSBuild\Build.msbuild
10:11:13 Run Build XXX with plugins and tools. Build Platform:'x64'
10:11:15 NuGet Version: 5.8.0.6930
10:11:16 MSBuild auto-detection: using msbuild version '16.3.0.46305' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
10:11:16 MSBuild P2P timeout [ms]: 120000
Calling the SonarScanner CLI...
INFO: Scanner configuration file: c:\jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScannerFW4.6MS410\sonar-scanner-4.4.0.2170\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: c:\jenkins\workspace\ine_topic-XXX-integration-YYY\src\.sonarqube\out\sonar-project.properties
10:12:47.065 INFO: SonarScanner 4.4.0.2170
10:12:47.068 INFO: Java 1.8.0_131 Oracle Corporation (64-bit)
10:12:47.068 INFO: Windows Server 2016 10.0 amd64
10:12:47.324 DEBUG: keyStore is :
10:12:47.324 DEBUG: keyStore type is : jks
10:14:17.817 DEBUG: GET 200 https://sonarcloud.io/api/ce/component?component=XXXXXX | time=182ms
10:14:17.821 WARN: The version of Java (1.8.0_131) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 11.
10:14:17.986 DEBUG: GET 200 https://sonarcloud.io/api/settings/was_analyzed_during_brownout?component=XXXXXX | time=164ms
10:14:17.987 INFO: ------------- Run sensors on module Quest.Schema.Sybase.Compare
10:14:18.117 INFO: JavaScript/TypeScript frontend is enabled
10:14:18.153 INFO: Load metrics repository
11:13:22 XXX@vm-buildffd510 c:\jenkins\workspace\ine_topic-XXX-integration-YYY\src>cmd.exe /C T:\Build\Jenkins\MSBuild\3.1_EndPerformBuild.bat
11:13:22 "c:\jenkins\tools\hudson.plugins.sonar.MsBuildSQRunnerInstallation\SonarScannerFW4.6MS410**\SonarScanner.MSBuild.exe" end /d:"sonar.login=******"**
11:13:22 SonarScanner for MSBuild 5.0.4
11:13:22 Using the .NET Framework version of the Scanner for MSBuild
11:13:22 Post-processing started.
11:15:22.226 WARN: The version of Java (1.8.0_131) you have used to run this analysis is deprecated and we will stop accepting it soon. Please update to at least Java 11.
Hi, well i did. But its not a solution i would like. I wasnt able to run Sonar MSbuild on newer Java when installed side by side with older Java.
I had to update the older Java on the VM, that introduce me to more stability issues (like this) of the Jenkins Node in Azure.
The issue of setting JavaRE for the SonarScanner.MSBuild.exe only occurred in Jenkins Pipeline.
I guess it was running inside a sandbox environment, where i couldn’t override the java_home or set default Java for sonar in any way.