Custom Java path for SonarScanner for .NET. Part 2

Hey Community,

This is a followup to a different thread, since what worked as a solution there, won’t work here:

Custom Java path for SonarScanner for .NET

Env:
SonarQube 10.3, SonarScanner for .NET - SonarScanner.MSbuild.exe v. 5.15.0.15354
Deployment from ZIP directly on Windows Server 2019 Standard (no VM)

SonarQube 10.3 warns me, that Java 17 will be required, so I would like tu upgrade Java, to be able to upgrade SonarQube.

However - I don’t want to touch Java version that is in JAVA_PATH. Our Bamboo CI/CD pipeline is on the same host with SonarScanner. CI/CD pipeline uses Java from JAVA_PATH and I do not want to touch Java version from JAVA_PATH - I am not willing to risk breaking our CI/CD for entire team.

How can I point SonarScanner for .NET to use a specific Java executable?

Any help will be appreciated,

Bests,
Michal

Hi Michal,

I’m not familiar with Bamboo pipelines, but can’t you change JAVA_HOME local to the job just before analysis runs like in this example?

 
Ann

Hi Ann,

Many thanks to you Ann, and for suggestion by @GilbertRebhan. Brilliant and hacky :slight_smile:

I’ll get back once I test it - it might be more than a week - vacation. Hope thread will stay alive till then.

Thanks again,
Michal

1 Like