我正在努力与声纳服务器和声纳跑步者(通过命令行独立)。我的项目声纳文件是:
# Required metadata
sonar.projectKey=org.codehaus.sonar:calculator
sonar.projectName=Calculator
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=py
# Encoding of the source files
sonar.sourceEncoding=UTF-8
我的命令是
/opt/sonar-runner/bin/sonar-runner -Dsonar.projectBaseDir=/var/lib/jenkins/workspace/Servidor-RDS/serv/rdsweb/WebContent/fccma/js/fcc/tests/python-sonar-runner/ -Dproject.settings=/var/lib/jenkins/workspace/Servidor-RDS/serv/rdsweb/WebContent/fccma/js/fcc/tests/python-sonar-runner/sonar-project.properties
没有异国情调。我没有声纳中的任何项目(我删除所有项目),我的项目结构是 SRC / myCaluclator / calculator.py 的初始化的.py
计算器代码是:
class Calculator(object):
def add(self, x, y):
return x + y
我总是得到:
Caused by: org.sonar.api.resources.DuplicatedSourceException: Duplicate source for resource: org.sonar.api.resources.File@7d3e8935[key=myCalculator/calculator.py,dir=myCalculator,filename=calculator.py,language=Python]
at org.sonar.batch.index.SourcePersister.saveSource(SourcePersister.java:45)
at org.sonar.batch.index.DefaultPersistenceManager.setSource(DefaultPersistenceManager.java:78)
at org.sonar.batch.index.DefaultIndex.setSource(DefaultIndex.java:456)
at org.sonar.batch.DefaultSensorContext.saveSource(DefaultSensorContext.java:161)
at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:88)
我需要清理一些缓存还是什么? 提前致谢。
答案 0 :(得分:3)
我找到了解决方案: sonar.sources存在于我的声纳 - 跑步者属性和我的项目属性中,因此所有文件都被声明了两次。
我的错误