Deprecation warning for Java 11

Hi all,

We are using Azure Devops for our builds on Sonar cloud. Whenever we open a PR, after the build the following warning occurs.

We are using self hosted agents and just merged from the upstream branch and built a new packer image. Upstream

Unfortunately it didn’t resolve the issue. Is see that on the agent Java 11 and 17 are installed. I changed the JAVA_HOME and updated alternatives to use 17 by default but it didn’t help.

I noticed Sonar cloud analyse is using version 1.41.0


but the Sonar prepare task is using version 1.38.0.

I also added in the Sonar cloud task the following to use JDK 17 but without success.

          - task: SonarCloudAnalyze@1
            condition: eq(${{ parameters.RunSonar }}, true)
            inputs:
              jdkversion: 'JAVA_HOME_17_X64'

I would appreciate any help you can offer. Thanks in advance

Kind regards,

Hi

You will need to use version 1.42 of the extension. I’m not sure how you’ve come to be using both 1.41 and 1.38. Can you try and update the extension version?

Kind regards

Tom

Thanks for the quick reply.

According to my Azure Devops configuration I already have the latest version. I always thought that extension updates are automatically done by AzDo.


Is there anything else I have to triggered manually or update on the agent?

@Tom_Howlett , do you maybe have any other idea what I could try to fix the issue?

Thanks in advance

Hi again

It’s good to see the extension is updated and I suspect the agent running the analysis is lagging behind somehow. This article might help to ensure that the agents are up to date.

Hope that helps

Tom

I tried to update the agents. But they are already on the latest version…
image
Is there something else I should be aware of?

Thanks

Hey @Tom_Howlett ,

Is there anything else I could try? In general we are very happy customers of Sonarcloud but this issue is really annoying and basically nullifies the use of auto complete in Azure Devops.

Thanks

Hi again

I think this is the route of your problem. It seems really strange that your extension is up to date and your agents are on the latest version but an older version of the task is being used. I can only think this is some sort of caching on the agents and I’ve never heard of it happening before. I’m afraid I’m at a bit of a loss as to what could be causing this, I’ll ask some other teams to see if they have any ideas.

Tom

1 Like

Hi Again

So after chatting with an engineer, it seems that the task versions are in fact different from the extension versions and the versions you have are correct so you are all up to date. Sorry for the confusion there.

This still leaves us with the problem of why you are still getting the warning. Have you tried setting JAVA_HOME just before the analysis runs?

This did the trick. I manually set JAVA_HOME before running the Sonar tasks and the warning disappeared.

          - task: Bash@3
            displayName: "Set Java Home"
            enabled: true
            inputs:
              targetType: 'inline'
              failOnStandardError: true
              script: |
                echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_17_X64)"
                echo "##vso[task.setvariable variable=PATH]$(JAVA_HOME_17_X64)\bin;$(PATH)"

Thank a lot @Tom_Howlett

2 Likes

That’s great, thanks for sharing your resolution :slight_smile:

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