在sonarqube日志中,我有: 引起原因: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
用于声纳配置的管道是:
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."
}
}
}
}
}
} ```
答案 0 :(得分:1)
最终帮助从本地运行声纳分析: mvn声纳:声纳-Dsonar.host.url = -Dsonar.login =