我们使用 Jenkins 构建应用程序并通过 Maven 对代码运行 Sonar 分析。
我能够创建本地服务器,并使用 Sonar 运行器运行 Sonar 分析。
我能够将我的 eclipse 实例连接到公司 sonarqube runner 并从 eclipse 的现有分析中获取问题。但是,当从 Eclipse 运行“分析”时,它失败了。
它返回, 您必须为“未知”定义以下强制属性:sonar.sources
当我查看该过程时,我发现临时文件夹中下载了一个临时 Sonar 运行程序,并创建了一个 sonar-project.properties 并使用它运行分析。该属性文件中没有定义 sonar.sources 。由于这个属性文件不在我的控制范围内,如何解决这个问题?
最佳答案
sonar-project.properties
配置文件必须位于 eclispe 项目的根目录中。它应该看起来像这样:
# Required metadata
sonar.projectKey=nutch-key
sonar.projectName=nutch-prj
sonar.projectVersion=1.0
# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional. If not set, SonarQube starts looking for source code
# from the directory containing the sonar-project.properties file.
sonar.sources=src
# Encoding of the source code
sonar.sourceEncoding=UTF-8
# Additional parameters
sonar.my.property=value
关于java - 从 Eclipse 实例运行 Sonar 代码分析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31762959/