我正试图通过遵循Travis文档SonarQube在Travis上为一个https://docs.travis-ci.com/user/sonarqube/项目设置https://docs.travis-ci.com/user/sonarqube/
我的.travis.yml文件如下所示:
sudo: required
cache:
directories:
- $HOME/.m2
language: java
services:
- docker
jdk:
- oraclejdk8
os:
- linux
env:
matrix:
- NEO_VERSION=3.0.9
WITH_DOCKER=true
EXTRA_PROFILES=-Pwith-neo4j-io
- NEO_VERSION=3.1.2
WITH_DOCKER=true
EXTRA_PROFILES=-Pwith-neo4j-io
addons:
sonarqube:
organization: ${SONAR_ORGANIZATION}
token:
secure: ${SONAR_TOKEN}
branches:
- master
- sonarqube
before_script:
script:
- build/run.sh
- sonar-scanner
install: true
after_success:
- mvn clean test jacoco:report coveralls:report
- "[ ${TRAVIS_PULL_REQUEST} = 'false' ] && [[ ${TRAVIS_BRANCH} = 'master' ]] && mvn clean deploy -DskipTests --settings ./deploy-settings.xml"我生成的sonar-scanner.properties文件是:
# must be unique in a given SonarQube instance
sonar.projectKey=liquigraph
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Liquigraph
sonar.projectVersion=1.0
# Set modules IDs
sonar.modules=liquigraph-cli,liquigraph-core,liquigraph-maven-plugin,liquigraph-spring-boot-starter,liquigraph-examples
# Modules inherit properties set at parent level
sonar.sources=src
sonar.sourceEncoding=UTF-8
sonar.language=java但是,当我提交和特拉维斯开始建设,声纳工作失败与以下日志:
. . .
$ sonar-scanner
INFO: Scanner configuration file: /home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.8
INFO: Java 1.8.0_111 Oracle Corporation (64-bit)
INFO: Linux 4.4.0-51-generic amd64
INFO: User cache: /home/travis/.sonar/cache
. . .
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 13.770s
INFO: Final Memory: 64M/505M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.sources
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.我确实把我的sonar-scanner.properties放在了我的项目文件夹的根目录中。为什么特拉维斯找不到而且正在使用/home/travis/.sonarscanner/sonar-scanner-2.8/conf/sonar-scanner.properties
发布于 2017-03-29 08:03:20
如果您的项目是Maven项目,那么只需使用Scanner for Maven:mvn sonar:sonar
有关详细信息,请查看https://about.sonarqube.com/get-started/。
如果您真的想使用SonarQube扫描仪,那么您的问题是您没有为配置文件使用正确的名称。应该是sonar-project.properties。
https://stackoverflow.com/questions/43079486
复制相似问题