简体   繁体   English

声纳项目集成

[英]Sonar project integration

Hi Ladies and Gentlemen, 嗨女士们,先生们,

We've quite big project with own build framework, based mostly on Java (however other languages exist). 我们有一个非常大的项目,有自己的构建框架,主要基于Java(但是存在其他语言)。

We'd like to use Sonar Hudson plugin to graphically present various code metrics. 我们想使用Sonar Hudson插件以图形方式呈现各种代码指标。 How do we do this? 我们如何做到这一点?

Do we need to change project structure and bring it to maven or there is a workaround to just specify where to get test results and other artifacts from? 我们是否需要更改项目结构并将其引入maven,或者有一种解决方法来指定从哪里获取测试结果和其他工件?

Thank you 谢谢

The method we are using is this: 我们使用的方法是这样的:

  • we built a custom pom.xml build file specific for sonar (we are using ant for other build purposes) 我们构建了一个特定于声纳的自定义pom.xml构建文件(我们使用ant进行其他构建)
  • it only has to perform test well, so specified hardcoded dependency references with 它只需要很好地执行测试,因此指定了硬编码的依赖引用

     <scope>system</scope> 
  • we didn't change the project structure for maven, you can specify in maven custom scr, test, resources directories (as long as you have only one src and test directory) 我们没有更改maven的项目结构,你可以在maven中指定自定义scr,test,resources目录(只要你只有一个src和test目录)

  • the command used in CI is CI中使用的命令是

     mvn clean compile sonar:sonar 

We are using Continuum for the CI part, but it should work just as well in Hudson. 我们正在使用Continuum作为CI部分,但它在Hudson中应该也能正常工作。

This method did not change any other build items, it's just custom made for Sonar. 这个方法没有改变任何其他构建项目,它只是为Sonar定制的。 But it does open the way for a Continuous Integration (daily) build, or for using maven as a build tool. 但它确实为持续集成(每日)构建或使用maven作为构建工具开辟了道路。 This method is similar to the "sonar light mode" described here 该方法类似于此处描述的“声纳光模式”

More information here: 更多信息:

You can use sonar without Maven. 您可以在没有Maven的情况下使用声纳。 you just have to tell it where the rport files are with properties: sonar.cobertura.reportPath, sonar.clover.reportPath, sonar.surefire.reportsPath… 你只需要告诉它rport文件的属性:sonar.cobertura.reportPath,sonar.clover.reportPath,sonar.surefire.reportsPath ...

See here: http://sonar.codehaus.org/tag/ant/ 见: http//sonar.codehaus.org/tag/ant/

There's a tick box to set these values when configuring the build in hudson - it is called "Check if this project is NOT built with maven2" 在hudson中配置构建时,有一个勾选框可以设置这些值 - 它被称为“检查此项目是否未使用maven2构建”

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM