gpt4 book ai didi

java - 在 Jenkins 上构建失败,导致 Sonar 分析失败

转载 作者:行者123 更新时间:2023-11-30 05:22:37 25 4
gpt4 key购买 nike

在 Sonar 日志中我有:引起原因:java.lang.IllegalStateException:无法处理组件“com.mts:mts:src/main/java/com/mts/web/dao/masterdata/StandardRate.java:BRANCH:develop”的问题引起原因:java.lang.IllegalStateException:属性“sonar.alm.github.app.id”不是一个长值:对于输入字符串:“sonarapp

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."
}
}
}
}
}
} ```

最佳答案

最终帮助从本地运行 Sonar 分析:mvn Sonar : Sonar -Dsonar.host.url=-Dsonar.login=

关于java - 在 Jenkins 上构建失败,导致 Sonar 分析失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59289495/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com