How to update Azure Pipeline for Sonar scanner to use Java 17

Hi,

This is not about updating your pipeline.

This is about updating your build agent. Delete Java 11 from your build agent and install Java 17.

 
Ann

Hi @ganncamp

One miss from my side

Hi Sumit,

Let’s back up. Are your build agents self-hosted?

Ann

No, they’re Azure hosted

Hi Sumit,

If they’re Azure-hosted, then I suggest you follow the relevant docs to upgrade Java there.

 
HTH,
Ann

Hi @ganncamp

Since its Azure-hosted, I’ve following concerns

  1. It is cloud-based so we don’t have access to install anything there

  2. if the agents will be running on Java 17, since they’re common, other tasks needing specific lower Java versions(I’m not sure, if any) start failing

Could you please provide some alternative suggestions to tackle this

Which Microsoft build image are you using?

Have you checked the Microsoft documentation to see if java is installed on the machine you are using?
Microsoft-hosted agents for Azure Pipelines - Azure Pipelines | Microsoft Learn

If you search each readme file it says what is installed on the machine. The windows 2019 machine has the following java versions installed:
image

I have in the past just used some powershell/bash scripts to install whatever I need on the Microsoft hosted machines. I don’t think they care as the machines get destroyed at the end of runs, (or what is more likely is that they are reverted to a checkpoint).

2 Likes

Thanks @andybrady that was very helpful

@ganncamp @andybrady All are agent-pools are using window-latest which is windows22 and has Java17 . Then what changes we should do to make this work



Thanks
Sumit

What happens if you change your SonarCloudAnalyze task to just this in your yaml rather than specifying the java version? (displayName parameter isn’t required)

  - task: SonarCloudAnalyze@1
    displayName: 'Run Code Analysis'

I get this @andybrady

Hi @ganncamp could you please ask if someone else in your team also check if you’re caught up in other activities, it’s been a while, I’m following up on this issue and our code analysis not happening because of this

Thanks
Sumit

@sonarcloud Can someone pitch in here ?

@sonarcloud ^^

@sonarsupport @SonarSorcerer ^^