我想在 Jenkins 上运行 Sonar 插件,而不需要任何构建过程(我的目的是将 Sonar 分析集成到 Jenkins 中,并利用我们已有的 subversion 插件和配置)。
我不想运行构建过程,因为这会占用不必要的时间;我只想要一份专门用于 Sonar 分析的 Jenkins 工作。
最佳答案
你可以做到。你必须triggering the analysis with the SonarQube Runner .
- 转到“构建”部分,点击“添加构建步骤”并选择“调用独立 Sonar 分析”
- 配置 SonarQube 分析。您可以指向现有的 sonar-project.properties 文件或直接在项目属性字段中设置分析属性
当您分析with SonarQube Runner时,那么您应该给出以下强制属性:
sonar.projectKey=my:project
sonar.projectName=My project
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
在这种情况下,您可能会错过一些违反规则的情况(例如 FindBugs),因为未提供 .class 文件。您必须手动构建项目并将 sonar.binaries
属性设置为您的类文件。如果您不想构建该项目,那么您可以使用 SourceMeter plugin for SonarQube也。它只需要源文件,但如果需要,可以生成更多指标和问题。
关于jenkins - 是否可以在 Jenkins 上运行 Sonar 插件而无需任何构建过程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24655063/