Hi all,
I’m having trouble setting up sonarcloud to be used with our Jenkins server and maven. I’m getting an error about sonarcloud.io having an invalid certificate which doesn’t make much sense so it’s possible I’m missing part of the configuration somewhere. Here is the error. I’ve been searching the forums and online, but I’m only finding instances of the same error when people are trying to reach their own SonarQube server not SonarCloud.
[INFO] --- sonar-maven-plugin:3.7.0.1746:sonar (default-cli) @ janus ---
[INFO] User cache: /root/.sonar/cache
[ERROR] SonarQube server [http://sonarcloud.io] can not be reached
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.337 s
[INFO] Finished at: 2020-12-16T20:01:04+00:00
[INFO] Final Memory: 35M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project XXX: Unable to execute SonarQube: Fail to get bootstrap index from server: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
[ERROR]
Can someone point me in a direction to go with solving this? I’ve been stuck for a while not sure what else to try.
Here’s some more information about what I’ve setup–maybe there’s something obvious I’m missing.
Added to pom.xml
<properties>
<java.version>1.8</java.version>
<sonar.projectKey>xxxxxxx</sonar.projectKey>
<sonar.organization>xxxxxxx</sonar.organization>
<sonar.host.url>http://sonarcloud.io</sonar.host.url>
</properties>
Jenkins Pipeline commands (running maven from docker image). I’ve added the ssl info to see if that might help, but it doesn’t (could be doing it wrong…).
stage ('SonarQube Scan') {
steps {
withSonarQubeEnv('SonarCloud') {
sh "docker run --rm --name my-maven-project -v ${env.workspace}:/usr/src/app -v ${env.pwd}/.m2:/root/.m2 -w /usr/src/app 368128804956.dkr.ecr.us-east-1.amazonaws.com/maven:1 mvn org.jacoco:jacoco-maven-plugin:prepare-agent verify \
sonar:sonar -Dsonar.branch.name=${env.BRANCH_NAME} -X \
-Dsonar.login=xxxxxxxxxxxxxxxxxxxxxxxxxxxx \
-Dsonar.organization=xxxxxxx \
-Dsonar.projectKey=xxxxxxx \
-Dsonar.host.url=https://sonarcloud.io \
-Djavax.net.ssl.trustStore=/etc/ssl/certs/java/cacerts"
}
}
}
Thanks in advance!