which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension) : * Community Edition Version 8.7.1 (build 42226)
what are you trying to achieve : Jenkins to sonar qualitygate integration
what have you tried so far to achieve this : I have configured Sonar Scanner and Sonar Quality Gate without any issues.
One thing i have observed here is the pipeline worked for one job iteam but the same pipeline is not working if i created new job.
Getting below error
15:03:39 [INFO] ------------- Run sensors on module gtcircuits Maven Webapp 15:03:39 [INFO] Load metrics repository 15:03:39 [INFO] Load metrics repository (done) | time=1583ms 15:03:39 [INFO] Sensor JavaSquidSensor [java] 15:03:39 [INFO] Configured Java source version (sonar.java.source): 8 15:03:39 [INFO] JavaClasspath initialization 15:03:39 [INFO] ------------------------------------------------------------------------ 15:03:39 [INFO] BUILD FAILURE 15:03:39 [INFO] ------------------------------------------------------------------------ 15:03:39 [INFO] Total time: 01:16 min 15:03:39 [INFO] Finished at: 2021-05-04T09:33:34Z 15:03:39 [INFO] ------------------------------------------------------------------------ 15:03:39 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project download: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property. → [Help 1] 15:03:39 [ERROR] 15:03:39 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 15:03:39 [ERROR] Re-run Maven using the -X switch to enable full debug logging. 15:03:39 [ERROR] 15:03:39 [ERROR] For more information about the errors and possible solutions, please read the following articles: 15:03:39 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [Pipeline] } 15:03:39 WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE
I have tried with providing compiled classes path but still same error.
The same configurations worked for the different pipeline, but when i create new pipepline with same configuration its giving the error.
15:03:39 [ERROR] For more information about the errors and possible solutions, please read the following articles: 15:03:39 [ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation [Pipeline] } 15:03:39 WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
Started by user prakash.hulamani
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/jenkins_home/workspace/Sonar_Quality_Testing
[Pipeline] {
[Pipeline] timestamps
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Tool Install)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Checkout Git)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] git
16:13:01 The recommended git tool is: NONE
16:13:01 using credential BitBucket2
16:13:01 > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/Sonar_Quality_Testing/.git # timeout=10
16:13:01 Fetching changes from the remote Git repository
16:13:01 > git config remote.origin.url http://dfwstp01.sial.com:7990/scm/gt/dap.git # timeout=10
16:13:01 Fetching upstream changes from http://dfwstp01.sial.com:7990/scm/gt/dap.git
16:13:01 > git --version # timeout=10
16:13:01 > git --version # ‘git version 2.11.0’
16:13:01 using GIT_ASKPASS to set credentials BitBucket2
16:13:01 > git fetch --tags --progress – http://dfwstp01.sial.com:7990/scm/gt/dap.git +refs/heads/:refs/remotes/origin/ # timeout=10
16:13:03 > git rev-parse refs/remotes/origin/Docker-Branch^{commit} # timeout=10
16:13:03 Checking out Revision e4ceba69d7f54948d50152bca62e12ad5d2a2875 (refs/remotes/origin/Docker-Branch)
16:13:03 > git config core.sparsecheckout # timeout=10
16:13:03 > git checkout -f e4ceba69d7f54948d50152bca62e12ad5d2a2875 # timeout=10
16:13:03 > git branch -a -v --no-abbrev # timeout=10
16:13:03 > git branch -D Docker-Branch # timeout=10
16:13:03 > git checkout -b Docker-Branch e4ceba69d7f54948d50152bca62e12ad5d2a2875 # timeout=10
16:13:03 Commit message: “Jenkinsfile edited online with Bitbucket”
16:13:03 > git rev-list --no-walk e4ceba69d7f54948d50152bca62e12ad5d2a2875 # timeout=10
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Quality Gate Status Check)
[Pipeline] tool
[Pipeline] envVarsForTool
[Pipeline] withEnv
[Pipeline] {
[Pipeline] script
[Pipeline] {
[Pipeline] withSonarQubeEnv
16:13:03 Injecting SonarQube environment variables using the configuration: SonarQube
[Pipeline] {
[Pipeline] sh
16:13:03 + mvn sonar:sonar
16:13:05 [INFO] Scanning for projects…
16:13:06 Downloading from spring-releases: https://repo.spring.io/libs-release/org/eclipse/m2e/lifecycle-mapping/1.0.0/lifecycle-mapping-1.0.0.pom
16:13:06 [WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
16:13:06 Downloading from spring-releases: https://repo.spring.io/libs-release/org/apache/maven/plugins/maven-metadata.xml
16:13:06 Downloading from spring-releases: https://repo.spring.io/libs-release/org/codehaus/mojo/maven-metadata.xml
16:13:06 [WARNING] Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/apache/maven/plugins/maven-metadata.xml 401 Unauthorized
16:13:06 [WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/codehaus/mojo/maven-metadata.xml 401 Unauthorized
16:13:06 Downloading from spring-releases: https://repo.spring.io/libs-release/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml
16:13:06 [WARNING] Could not transfer metadata org.codehaus.mojo:sonar-maven-plugin/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml 401 Unauthorized
16:13:06 [INFO]
16:13:06 [INFO] ---------------------< com.merck.enterpriseux:dap >---------------------
16:13:06 [INFO] Building dap 0.0.1-SNAPSHOT
16:13:06 [INFO] --------------------------------[ war ]---------------------------------
16:13:06 [WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0
16:13:06 [WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata.xml from https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/apache/maven/plugins/maven-metadata.xml 401 Unauthorized
16:13:06 [WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml from https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/codehaus/mojo/maven-metadata.xml 401 Unauthorized
16:13:06 [WARNING] Failure to transfer org.codehaus.mojo:sonar-maven-plugin/maven-metadata.xml from https://repo.spring.io/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of spring-releases has elapsed or updates are forced. Original error: Could not transfer metadata org.codehaus.mojo:sonar-maven-plugin/maven-metadata.xml from/to spring-releases (https://repo.spring.io/libs-release): Authentication failed for https://repo.spring.io/libs-release/org/codehaus/mojo/sonar-maven-plugin/maven-metadata.xml 401 Unauthorized
16:13:06 Downloading from spring-releases: https://repo.spring.io/libs-release/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
16:13:07 [WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
16:13:07 [WARNING] Try running the build up to the lifecycle phase “package”
16:13:07 [INFO]
16:13:07 [INFO] — sonar-maven-plugin:3.9.0.2155:sonar (default-cli) @ dap —
16:13:07 [INFO] User cache: /root/.sonar/cache
16:13:07 [INFO] SonarQube version: 8.7.1
16:13:07 [INFO] Default locale: “en”, source code encoding: “UTF-8”
16:13:07 [WARNING] SonarScanner will require Java 11 to run starting in SonarQube 9.x
16:13:07 [INFO] Load global settings
16:13:09 [INFO] ------------------------------------------------------------------------
16:13:09 [INFO] BUILD FAILURE
16:13:09 [INFO] ------------------------------------------------------------------------
16:13:09 [INFO] Total time: 3.966 s
16:13:09 [INFO] Finished at: 2021-06-01T10:43:08Z
16:13:09 [INFO] ------------------------------------------------------------------------
16:13:09 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project dap: Not authorized. Please check the properties sonar.login and sonar.password. → [Help 1]
16:13:09 [ERROR]
16:13:09 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
16:13:09 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
16:13:09 [ERROR]
16:13:09 [ERROR] For more information about the errors and possible solutions, please read the following articles:
16:13:09 [ERROR] [Help 1] MojoExecutionException - Apache Maven - Apache Software Foundation
[Pipeline] }
16:13:09 WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?
[Pipeline] // withSonarQubeEnv
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE
What did you make of the error message? It’s actually pretty clear IMO:
16:13:09 [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project dap: Not authorized. Please check the properties sonar.login and sonar.password.