简体   繁体   English

从Eclipse实例运行Sonar代码分析

[英]Running Sonar Code Analysis from Eclipse Instance

We use Jenkins for both building application and running sonar analysis through maven on the code. 我们使用Jenkins来构建应用程序并通过代码上的maven运行声纳分析。

I am able create a local server, and run sonarqube analysis using sonar runner. 我能够创建本地服务器,并使用声纳运行器运行声纳分析。

I was able to connect my eclipse instance to the company sonarqube runner and get the issues from existing analysis on eclipse. 我能够将eclipse实例连接到公司声纳赛跑者,并从对eclipse的现有分析中获得问题。 But while running 'Analyse' from eclipse, it fails. 但是从Eclipse运行“分析”时,它失败了。

It returns, You must define the following mandatory properties for 'Unknown': sonar.sources 它返回, 您必须为“未知”定义以下必需属性:sonar.sources

While I looked into the process, I found that, a temporary sonar-runner is downloaded in the temp folder and a sonar-project.properties is created and the analysis is run using that. 在研究过程时,我发现在temp文件夹中下载了一个临时声纳运行器,并创建了sonar-project.properties并使用该运行分析。 This property file does not have the sonar.sources defined inside it. 此属性文件中没有定义sonar.sources。 Since this property file is not in my control, How to resolve this issue? 由于此属性文件不在我的控制范围内,如何解决此问题?

The sonar-project.properties config file must be in the root of your eclispe project. sonar-project.properties配置文件必须位于eclispe项目的根目录中。 And it should looks like this: 它应该看起来像这样:

# 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

SQ Eclipse plugin will use the configured Eclipse (JDT) source folders and pass them to sonar.sources. SQ Eclipse插件将使用配置的Eclipse(JDT)源文件夹,并将它们传递给sonar.sources。 Check that you have some source folders configured (Right click on project -> Properties -> Java build path). 检查是否已配置一些源文件夹(右键单击项目->属性-> Java构建路径)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从命令行运行声纳分析时出现链接错误(maven 项目) - Linkage Error on running sonar analysis from command line (maven project) 当我从Eclipse(Juno)运行Sonar本地分析时出错-我使用Maven构建 - Error when i run Sonar local analysis from Eclipse (Juno) - i used maven to build 使用mvn声纳运行声纳分析:声纳忽略sonar-project.properties - Running sonar analysis with mvn sonar:sonar ignores sonar-project.properties 从Jenkins / Hudson Plugin运行时,如何在声纳报告中从cobertura分析中排除类? - How to exclude classes from cobertura analysis in sonar report when running from Jenkins/Hudson Plugin? 用Jenkinsfile和maven启动对pullRequest代码的声纳分析 - launch a sonar analysis for the code of a pullRequest with Jenkinsfile and maven Eclipse中的代码分析 - Code analysis in Eclipse 将静态代码分析从单独的进程移动到Eclipse插件 - Moving static code analysis from a separate process to an Eclipse plug-in 在对本机项目运行声纳分析时,得到与sonar.java.binaries属性相关的错误 - On running sonar analysis on react-native project getting error related to sonar.java.binaries property 如何修复声纳在代码分析过程中引发ArrayIndexOutOfBoundsException - How to fix sonar throws ArrayIndexOutOfBoundsException during code analysis 声纳对webapp进行分析时,是否只是在分析Java代码? - When sonar performs an analysis of a webapp is it just analysing java code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM