SonarQubeAnalyze@7 overwrites default JAVA_HOME environment variable

Hi BV, I’m very sorry for the late response, this has fallen through the cracks.

Since you’re machine already has Java set up, you can skip the JRE auto-provisioning (which is causing the override). Just add an additional parameter to the prepare step:

- task: SonarQubePrepare@7
          displayName: SonarQube - Prepare
          inputs:
            SonarQube: 'SonarQube OnPrem'
            scannerMode: 'cli'
            configMode: 'manual'
            projectKey: '<PROJECT_KEY>'
            projectName: '<PROJECT_NAME>'
            cliSources: '$(System.DefaultWorkingDirectory)/Client/src'
            extraProperties: |
              sonar.scanner.skipJreProvisioning=true

I hope this helps!
Tim

1 Like