简体   繁体   English

基于 jenkins 构建失败,原因是声纳分析失败

[英]Build on jenkins failed couse sonarqube analysis failed

In sonarqube log I have : Caused by: java.lang.IllegalStateException: Fail to process issues of component 'com.mts:mts:src/main/java/com/mts/web/dao/masterdata/StandardRate.java:BRANCH:develop' Caused by: java.lang.IllegalStateException: The property 'sonar.alm.github.app.id' is not an long value: For input string: "sonarapp在 sonarqube 日志中,我有: 引起:java.lang.IllegalStateException:无法处理组件 'com.mts:mts:src/main/java/com/mts/web/dao/masterdata/StandardRate.java:BRANCH 的问题:开发'引起:java.lang.IllegalStateException:属性'sonar.alm.github.app.id'不是一个长值:对于输入字符串:“sonarapp

Pipeline for sonarqube configuration is: sonarqube 配置的管道是:

           steps {
               withSonarQubeEnv('Central Sonar') {
                   withCredentials([string(credentialsId: 'crdb_github_token', variable: 'TOKEN'), string(credentialsId: 'mts_sonarcube_token', variable: 'SONAR_TOKEN')]) {
                       script {
                           def goals = 'sonar:sonar  '
                           def opts = "-Dsonar.host.url=${SONAR_HOST_URL} " +
                                   "-Dsonar.login=${SONAR_TOKEN} "

                           try {
                               if (env.CHANGE_ID != null && env.CHANGE_ID != '') {
                                   opts += "-Dsonar.analysis.mode=preview " +
                                           "-Dsonar.github.pullRequest=${env.CHANGE_ID} " +
                                           "-Dsonar.github.oauth=${TOKEN} " +
                                           "-Dsonar.github.repository=IPT-CRDB-2213/mts " +
                                           "-Dsonar.github.endpoint=https://git.com/api/v3"

                                   // sh "${scannerHome}/bin/sonar-scanner ${opts}"
                                   def oldOpts = rtMaven.opts
                                   rtMaven.opts = opts
                                   rtMaven.run pom: 'pom.xml', goals: goals
                                   rtMaven.opts = oldOpts
                               } else if (env.UNIFIED_BRANCH_NAME == 'master' || env.UNIFIED_BRANCH_NAME == 'develop')  {
                                   opts += "-Dsonar.branch.name=${env.UNIFIED_BRANCH_NAME}"

                                   // sh "${scannerHome}/bin/sonar-scanner ${opts}"
                                   def oldOpts = rtMaven.opts
                                   rtMaven.opts = opts
                                   rtMaven.run pom: 'pom.xml', goals: goals
                                   rtMaven.opts = oldOpts
                               }
                           } catch (err) {
                               echo err.getMessage()
                               echo "Error detected, but we will continue."
                           }
                       }
                   }
               }
           }
       } ``` 

最后帮助从本地运行声纳分析: mvn sonar:sonar -Dsonar.host.url= -Dsonar.login=

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM