I am trying to run SonarQube in an Azure DevOps Pipeline, in the SonarQubeAnalysis@5 it errors that it cannot find java in either JAVA_HOME nor PATH.
I am pretty sure java is installed and is set as an environment variable in the agent VM.
I suspect the issue is in the wrapper.conf file. Question what is the default location where the wrapper.conf looks for java?
How can I change/update the current location of java in the wrapper.conf in the SonarQubePrepare/extraProperties?
There should be a way for me to change that in the pipeline.
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
2023-05-17T23:50:35.2692807Z ##[section]Starting: SonarQubeAnalyze
2023-05-17T23:50:35.2697081Z ==============================================================================
2023-05-17T23:50:35.2697433Z Task : Run Code Analysis
2023-05-17T23:50:35.2697517Z Description : Run scanner and upload the results to the SonarQube server.
2023-05-17T23:50:35.2697653Z Version : 5.13.0
2023-05-17T23:50:35.2697730Z Author : sonarsource
2023-05-17T23:50:35.2697812Z Help : Version: 5.13.0. This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.
[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
2023-05-17T23:50:35.2698083Z ==============================================================================
2023-05-17T23:50:36.4549847Z [command]/agent/_work/_tasks/SonarQubeAnalyze_6d01813a-xxxxxxx/5.13.0/sonar-scanner/bin/sonar-scanner
2023-05-17T23:50:36.4746467Z ##[error]Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
2023-05-17T23:50:36.4747754Z Unrecognized option: -
2023-05-17T23:50:36.4748101Z Error: Could not create the Java Virtual Machine.
2023-05-17T23:50:36.4748459Z Error: A fatal exception has occurred. Program will exit.
2023-05-17T23:50:36.4811335Z ##[error]The process '/agent/_work/_tasks/SonarQubeAnalyze_6d01813a-xxxxxx/5.13.0/sonar-scanner/bin/sonar-scanner' failed with exit code 1
2023-05-17T23:50:36.4851155Z ##[section]Finishing: SonarQubeAnalyze