Unable to run the scanner using Jenkins job

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

  • what are you trying to achieve

  • what have you tried so far to achieve this

  • Sonarqube -8.9.6 LTS community

  • Unable scan the code in the sonarqube and getting sonarqube not reachable issue.
    Below the issue I’m getting when ran the jenkins jobs

[INFO]

[INFO] — sonar-maven-plugin:3.9.1.2184:sonar (default-cli) @ sync-location-tracking —

[INFO] User cache: /root/.sonar/cache

[ERROR] SonarQube server [ https://sonarqube.xxx.io ] can not be reached

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 40.281 s

[INFO] Finished at: 2022-05-20T07:27:41Z

[INFO] ------------------------------------------------------------------------

[WARNING] The requested profile “sonar” could not be activated because it does not exist.

Waiting for Jenkins to finish collecting data

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project sync-location-tracking: Unable to execute SonarScanner analysis: Fail to get bootstrap index from server: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target → [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Hey there.

This is a pretty standard Java error when running into an untrusted certificate (likely, your SonarQube server is using a self-signed certificate).

You’ll need to make sure your Java installation trusts your server’s certificate. There are many helpful approaches you can find online.