我有一个java项目,我想将它与SonarCloud集成,我遵循以下正式步骤:
使用SonarQube扫描仪#检查代码 在检查代码之前,您需要:
添加我的travis.yml文件
addons:
sonarcloud:
organization: "xelian-github"
token:
secure: ${SONAR_TOKEN}
branches:
- master
script:
# other script steps might be done before running the actual analysis
- sonar-scanner其中SONAR_TOKEN是特拉维斯CI上的一个变量,指向来自SonarCloud的密钥(它没有加密)。

从SonarCloud添加权限

但是,当我启动travis构建时,我有以下错误:
Setting environment variables from repository settings
$ export SONAR_TOKEN=[secure]
....
ERROR: Error during SonarQube Scanner execution
ERROR: You're only authorized to execute a local (preview) SonarQube analysis without pushing the results to the SonarQube server. Please contact your SonarQube administrator.
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.在我看来,我的travis没有将结果上传到SonarCloud的权限。是令牌或某些声纳配置中的问题。
发布于 2017-09-29 06:47:19
发布于 2017-09-28 17:31:16
最后我找到了解决办法。在根路径中,您必须添加yml文件:
sonar-project.properties
# Required metadata
sonar.projectKey=java-sonar-runner-simple:master
sonar.projectName=Rss-service
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=/microservice-application/rss-reader-service/src/main/java
sonar.java.binaries=/microservice-application/rss-reader-service/target/classes
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8在travis.yml中,我添加: script:
# other script steps might be done before running the actual analysis
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar编辑
声纳-投射。没有必要。只有maven的目标才有意义。
https://stackoverflow.com/questions/46462540
复制相似问题