我在Github上有一个集成了Travis CI的Spring Boot项目存储库。目前,Travis CI已配置为针对提交和请求请求构建项目,效果很好。
接下来,我想将Jacoco报告发送给SonarCloud。我已经在Travis上关注了Wiki,但是当我查看SoundCloud项目时,没有显示任何内容。以下是我的配置:
SonarCloud
帐户的身份验证令牌:我已经在 SonarCloud 上生成了该令牌,并将其设置在Travis -> Environment Variables -> SONAR_TOKEN
中。
.travis.yml
script:
- mvn install -P test
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report package sonar:sonar
addons:
sonarcloud:
organization: "my_organization_name_on_SonarCloud"
项目的 src / main / resources / sonar-project.properties
sonar.projectKey=my_project_key_on_SonarCloud
sonar.projectName=my_project_name
sonar.projectVersion=0.0.1
sonar.sources=.
Jacoco-maven-plugin
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.3</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
以下是Travis CI作业日志
Setting environment variables from repository settings
$ export SONAR_TOKEN=[secure]
SonarCloud addon
addon hash: de356982c12b370c7bfe9c5317053863
Preparing SonarQube Scanner CLI
Archive: /home/travis/.sonarscanner/sonar-scanner.zip
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner.bat
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/sonar-scanner-cli-3.0.3.778.jar
$ export SONAR_SCANNER_HOME=${TRAVIS_HOME}/.sonarscanner/sonar-scanner-3.0.3.778
Not installing SonarSource build-wrapper because it's a Java or Javascript project
Preparing SonarQube Scanner parameters0.00s
$
The command "" exited with 0.
有人可以指出我在这里缺少什么吗?
谢谢。
答案 0 :(得分:0)
脚本: -mvn全新安装-B -mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey = ...
sudo:必需 插件: 声纳云: 组织:... 令牌: 安全:$ SONAR_TOKEN
您可以尝试以上