SonarQube task causes vs test platform installer task Azure Pipeline to fail

We are running multiple Azure pipelines on an on-prem environment, which very similar. Today I added SonarQube tasks on one of them for integration with SonarQube.

  1. Prepare for Analysis
  2. Run Code Analysis
  3. publish Quality gateway result

Now the Task for ’ Visual Studio test platform installer ’ fails and reports

##[error]This task is supported only on Windows agents and cannot be used on other platforms.

And as soon as I remove the SonarQube tasks the pipeline works again. The pipeline never passes the first SQ task and reordering does not help.

Update:

I removed tasks 2 and 3 and the pipeline works. As soon as a I add step 2, it fails again

CI pipeline yml below

> trigger:
>   branches:
>     include:
>     - develop
>   batch: True
> name: $(date:yyyyMMdd)$(rev:.r)
> resources:
>   repositories:
>   - repository: self
>     type: git
>     ref: refs/heads/develop
> jobs:
> - job: Phase_1
>   displayName: Phase 1
>   cancelTimeoutInMinutes: 1
>   pool:
>     name: Default
>   steps:
>   - checkout: self
>   - task: NodeTool@0
>     displayName: Use Node 14.x
>     inputs:
>       versionSpec: 14.x
>       checkLatest: true
>   - task: DotNetCoreInstaller@0
>     displayName: Use .NET Core sdk 6.0.101
>     inputs:
>       version: 6.0.101
>   - task: SonarQubePrepare@5
>     displayName: Prepare analysis on SonarQube
>     inputs:
>       SonarQube: XXX
>       projectKey: XXX
>       projectName: XXX
>   - task: VisualStudioTestPlatformInstaller@1
>     displayName: VsTest Platform Installer
>     inputs:
>       versionSelector: specificVersion
>       testPlatformVersion: 16.8.3
>   - task: NuGetToolInstaller@0
>     displayName: Use NuGet 5.8.x
>     inputs:
>       versionSpec: 5.8.x
>   - task: DotNetCoreCLI@2
>     displayName: dotnet custom
>     inputs:
>       command: custom
>       projects: '**/XXX.sln'
>       custom: restore
>       arguments: --source https://XXX -r win-x86
>       selectOrConfig: config
>   - task: DotNetCoreCLI@2
>     displayName: dotnet build
>     inputs:
>       projects: '**/XXX.sln'
>       arguments: /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="bin\WebAppContent" /p:BuildPlatform="$(BuildPlatform)" /p:BuildConfiguration="$(BuildConfiguration)"
>   - task: MSBuild@1
>     displayName: Build solution **/XXX.sln
>     enabled: False
>     inputs:
>       solution: '**/XXX.sln'
>       msbuildLocationMethod: location
>       msbuildLocation: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe
>       platform: $(BuildPlatform)
>       configuration: $(BuildConfiguration)
>       msbuildArguments: /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True /p:publishUrl="bin\WebAppContent" /p:RuntimeIdentifier=win-x86
>       maximumCpuCount: true
>       logProjectEvents: true
>   - task: VSTest@2
>     name: VSTest_4
>     displayName: Test Assemblies **\$(BuildConfiguration)\*test*.dll;-:**\obj\**
>     inputs:
>       testAssemblyVer2: >-
>         **\*unittest*.dll
> 
>         !**\obj\**
> 
>         !**\ref\**
>       runOnlyImpactedTests: false
>       vsTestVersion: toolsInstaller
>       runInParallel: true
>       codeCoverageEnabled: true
>       platform: $(BuildPlatform)
>       configuration: $(BuildConfiguration)
>   - task: SonarQubeAnalyze@5
>     displayName: Run Code Analysis
>   - task: SonarQubePublish@5
>     displayName: Publish Quality Gate Result
>   - task: ArchiveFiles@2
>     displayName: Archive Apps.Api
>     inputs:
>       rootFolderOrFile: source\Apps\Apps.Api\bin\WebAppContent
>       includeRootFolder: false
>       archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).Apps.Api.zip
>   - task: ArchiveFiles@2
>     displayName: Archive Hub.Api
>     inputs:
>       rootFolderOrFile: source\Hub\Hub.Api\bin\WebAppContent
>       includeRootFolder: false
>       archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).Hub.Api.zip
>   - task: ArchiveFiles@2
>     displayName: Archive Rmi.Api
>     inputs:
>       rootFolderOrFile: source\Rmi\Rmi.Api\bin\WebAppContent
>       includeRootFolder: false
>       archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).Rmi.Api.zip
>   - task: ArchiveFiles@2
>     displayName: Archive Hub.WebClient
>     inputs:
>       rootFolderOrFile: source\Hub\Hub.WebClient\bin\WebAppContent
>       includeRootFolder: false
>       archiveFile: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).Hub.WebClient.zip
>   - task: CopyFiles@2
>     name: CopyFiles_5
>     displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
>     enabled: False
>     inputs:
>       SourceFolder: $(build.sourcesdirectory)
>       Contents: '**\bin\$(BuildConfiguration)\PublishOutput\**'
>       TargetFolder: $(build.artifactstagingdirectory)
>       CleanTargetFolder: true
>   - task: PublishBuildArtifacts@1
>     name: PublishBuildArtifacts_6
>     displayName: 'Publish Artifact: drop'
>     inputs:
>       PathtoPublish: $(build.artifactstagingdirectory)
>       TargetPath: '\\my\share\$(Build.DefinitionName)\$(Build.BuildNumber)'

Hi,

Since this is putativly about your environment, can we have the details of it? Also, it would be good to see your job log.

 
Ann

HI Ann.
Thx for your reply. Which details would you need to see?

Added content of the logfile 9_‘Run Code Analysis.txt’ and I think there might be a hint at 2022-03-22T15:39:43.7923587Z

2022-03-22T15:39:41.9632680Z ##[section]Starting: Run Code Analysis
2022-03-22T15:39:41.9651880Z ==============================================================================
2022-03-22T15:39:41.9652160Z Task         : Run Code Analysis
2022-03-22T15:39:41.9652425Z Description  : Run scanner and upload the results to the SonarQube server.
2022-03-22T15:39:41.9652658Z Version      : 5.4.0
2022-03-22T15:39:41.9652838Z Author       : sonarsource
2022-03-22T15:39:41.9653292Z Help         : Version: 5.4.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2022-03-22T15:39:41.9653774Z ==============================================================================
2022-03-22T15:39:42.0981259Z [command]/azp/agent/_work/_tool/dncs/6.0.101/x64/dotnet /azp/agent/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.4.0/dotnet-sonar-scanner-msbuild/SonarScanner.MSBuild.dll end
2022-03-22T15:39:42.2030117Z SonarScanner for MSBuild 5.5.3
2022-03-22T15:39:42.2031806Z Using the .NET Core version of the Scanner for MSBuild
2022-03-22T15:39:42.2630341Z Post-processing started.
2022-03-22T15:39:42.4480166Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/microsoft.net.test.sdk/17.0.0/build/netcoreapp2.1/Microsoft.NET.Test.Sdk.Program.cs' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4482009Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/microsoft.testplatform.testhost/17.0.0/build/netcoreapp2.1/Microsoft.TestPlatform.PlatformAbstractions.dll' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4483419Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/mstest.testadapter/2.2.8/build/_common/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4484912Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/mstest.testadapter/2.2.8/build/_common/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4486469Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/mstest.testadapter/2.2.8/build/netcoreapp1.0/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4487745Z 15:39:42.447  15:39:42.447  WARNING: File '/root/.nuget/packages/mstest.testadapter/2.2.8/build/netcoreapp1.0/Microsoft.TestPlatform.AdapterUtilities.dll' is not located under the root directory '/azp/agent/_work/28/s/source' and will not be analyzed.
2022-03-22T15:39:42.4751672Z Calling the SonarScanner CLI...
2022-03-22T15:39:42.6611417Z INFO: Scanner configuration file: /azp/agent/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.4.0/dotnet-sonar-scanner-msbuild/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
2022-03-22T15:39:42.6613040Z INFO: Project root configuration file: /azp/agent/_work/28/.sonarqube/out/sonar-project.properties
2022-03-22T15:39:42.7026167Z INFO: SonarScanner 4.6.2.2472
2022-03-22T15:39:42.7027628Z INFO: Java 1.8.0_292 Private Build (64-bit)
2022-03-22T15:39:42.7028814Z INFO: Linux 5.15.5-0-virt amd64
2022-03-22T15:39:42.9146290Z INFO: User cache: /root/.sonar/cache
2022-03-22T15:39:43.0698046Z INFO: Scanner configuration file: /azp/agent/_work/_tasks/SonarQubePrepare_15b84ca1-b62f-4a2a-a403-89b77a063157/5.4.0/dotnet-sonar-scanner-msbuild/sonar-scanner-4.6.2.2472/conf/sonar-scanner.properties
2022-03-22T15:39:43.0699543Z INFO: Project root configuration file: /azp/agent/_work/28/.sonarqube/out/sonar-project.properties
2022-03-22T15:39:43.0844949Z INFO: Analyzing on SonarQube server 8.9.7
2022-03-22T15:39:43.0848337Z INFO: Default locale: "en_US", source code encoding: "UTF-8" (analysis is platform dependent)
2022-03-22T15:39:43.2865548Z WARN: SonarScanner will require Java 11 to run, starting in SonarQube 9.x
2022-03-22T15:39:43.4496023Z INFO: Load global settings
2022-03-22T15:39:43.5972196Z INFO: Load global settings (done) | time=148ms
2022-03-22T15:39:43.6008883Z INFO: Server id: A7EE8CF2-AW8eBZ6CCT8_viXRocjh
2022-03-22T15:39:43.6042742Z INFO: User cache: /root/.sonar/cache
2022-03-22T15:39:43.6068781Z INFO: Load/download plugins
2022-03-22T15:39:43.6071466Z INFO: Load plugins index
2022-03-22T15:39:43.6791359Z INFO: Load plugins index (done) | time=72ms
2022-03-22T15:39:43.7383968Z INFO: Load/download plugins (done) | time=131ms
2022-03-22T15:39:43.7633004Z INFO: ------------------------------------------------------------------------
2022-03-22T15:39:43.7674521Z INFO: EXECUTION FAILURE
2022-03-22T15:39:43.7675472Z INFO: ------------------------------------------------------------------------
2022-03-22T15:39:43.7675834Z INFO: Total time: 1.117s
2022-03-22T15:39:43.7920405Z INFO: Final Memory: 7M/180M
2022-03-22T15:39:43.7921919Z INFO: ------------------------------------------------------------------------
2022-03-22T15:39:43.7923587Z ##[error]ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: The plugin [cxx] does not support Java 1.8.0_292
	at org.sonar.core.platform.PluginClassLoader.instantiatePluginClasses(PluginClassLoader.java:133)
2022-03-22T15:39:43.7924827Z ERROR: Error during SonarScanner execution
2022-03-22T15:39:43.7925661Z java.lang.IllegalStateException: The plugin [cxx] does not support Java 1.8.0_292
2022-03-22T15:39:43.7926177Z 	at org.sonar.core.platform.PluginClassLoader.instantiatePluginClasses(PluginClassLoader.java:133)
2022-03-22T15:39:43.7943635Z ##[error]at org.sonar.core.platform.PluginClassLoader.load(PluginClassLoader.java:67)
	at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:65)
	at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$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:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.UnsupportedClassVersionError: org/sonar/plugins/cxx/CxxPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
	at org.sonar.core.platform.PluginClassLoader.instantiatePluginClasses(PluginClassLoader.java:131)
	... 26 more
ERROR:
2022-03-22T15:39:43.7950423Z 	at org.sonar.core.platform.PluginClassLoader.load(PluginClassLoader.java:67)
2022-03-22T15:39:43.7951254Z 	at org.sonar.scanner.bootstrap.ScannerPluginRepository.start(ScannerPluginRepository.java:65)
2022-03-22T15:39:43.7967768Z 	at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
2022-03-22T15:39:43.7968304Z 	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
2022-03-22T15:39:43.7968787Z 	at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
2022-03-22T15:39:43.7969210Z 	at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
2022-03-22T15:39:43.7969604Z 	at org.picocontainer.behaviors.Stored.start(Stored.java:110)
2022-03-22T15:39:43.7970018Z 	at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
2022-03-22T15:39:43.7970493Z 	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
2022-03-22T15:39:43.7970913Z 	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
2022-03-22T15:39:43.7971346Z 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
2022-03-22T15:39:43.7971783Z 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
2022-03-22T15:39:43.7972177Z 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
2022-03-22T15:39:43.7972544Z 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
2022-03-22T15:39:43.7972974Z 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
2022-03-22T15:39:43.7973372Z 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2022-03-22T15:39:43.7973765Z 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2022-03-22T15:39:43.7974200Z 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2022-03-22T15:39:43.7974593Z 	at java.lang.reflect.Method.invoke(Method.java:498)
2022-03-22T15:39:43.7974997Z 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
2022-03-22T15:39:43.7975381Z 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
2022-03-22T15:39:43.7975727Z 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
2022-03-22T15:39:43.7976147Z 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
2022-03-22T15:39:43.7976531Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
2022-03-22T15:39:43.7976881Z 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
2022-03-22T15:39:43.7977228Z 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
2022-03-22T15:39:43.7977789Z Caused by: java.lang.UnsupportedClassVersionError: org/sonar/plugins/cxx/CxxPlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2022-03-22T15:39:43.7978612Z 	at java.lang.ClassLoader.defineClass1(Native Method)
2022-03-22T15:39:43.7978934Z 	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2022-03-22T15:39:43.7979319Z 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2022-03-22T15:39:43.7979715Z 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
2022-03-22T15:39:43.7980082Z 	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2022-03-22T15:39:43.7980442Z 	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2022-03-22T15:39:43.7980934Z 	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2022-03-22T15:39:43.7981329Z 	at java.security.AccessController.doPrivileged(Native Method)
2022-03-22T15:39:43.7982389Z 	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2022-03-22T15:39:43.7982805Z 	at org.sonar.classloader.ClassRealm.loadClassFromSelf(ClassRealm.java:125)
2022-03-22T15:39:43.7983428Z 	at org.sonar.classloader.ParentFirstStrategy.loadClass(ParentFirstStrategy.java:37)
2022-03-22T15:39:43.7984386Z 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:87)
2022-03-22T15:39:43.7984778Z 	at org.sonar.classloader.ClassRealm.loadClass(ClassRealm.java:76)
2022-03-22T15:39:43.7985191Z 	at org.sonar.core.platform.PluginClassLoader.instantiatePluginClasses(PluginClassLoader.java:131)
2022-03-22T15:39:43.7985527Z 	... 26 more
2022-03-22T15:39:43.7985728Z ERROR: 
2022-03-22T15:39:43.8139744Z ##[error]The SonarScanner did not complete successfully
2022-03-22T15:39:43.8140547Z The SonarScanner did not complete successfully
2022-03-22T15:39:43.8141574Z ##[error]15:39:43.813  Post-processing failed. Exit code: 1
2022-03-22T15:39:43.8142384Z 15:39:43.813  Post-processing failed. Exit code: 1
2022-03-22T15:39:43.8227629Z ##[error]The process '/azp/agent/_work/_tool/dncs/6.0.101/x64/dotnet' failed with exit code 1
2022-03-22T15:39:43.8298357Z ##[section]Finishing: Run Code Analysis

Hi,

Thanks for the analysis log.

The cxx plugin isn’t supported in this community. You’ll need to direct your questions to its maintainers.

 
Ann

I found the solution myself. The java version on the server was to old.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.