我在 Github 上有一个集成了 Travis CI 的 Spring Boot 项目存储库。目前 Travis CI 配置为为提交和拉取请求构建项目,效果很好。
接下来,我想向 SonarCloud 发送 Jacoco 报告。我在 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> <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.
有人可以指出我在这里缺少什么吗?
提前致谢。