0

我正在为声纳服务器和声纳运行器(通过命令行独立)而苦苦挣扎。我的项目声纳文件是:

# 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 init .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)

我需要清理一些缓存吗?提前致谢。

4

1 回答 1

3

我找到了解决方案: sonar.sources 存在于我的 sonar-runner 属性和我的项目属性中,因此所有文件都被声明了两次。

我的错误

于 2013-05-13T15:17:34.133 回答