As part of our build pipelines, we run a code analysis through SonarQube. After moving SonarQube to a different server, our Azure DevOps pipelines started to fail.
When I opened the build logs, I noticed the following error message:
ERROR: JAVA_HOME exists but does not point to a valid Java home folder. No “bin\java.exe” file can be found there.
I logged in on our SonarQube server and checked the value of the JAVA_HOME environment variable:
JAVA_HOME = c:\program files\Zulu\zulu-11\bin\
Based on the error message above, it seems that the SonarScanner expects that we don’t include the ‘bin’ folder. So I updated the environment variable to:
JAVA_HOME = c:\program files\Zulu\zulu-11
After rescheduling the build, the SonarQube analysis task completed succesfully.