如何使Jenkins,Sonar和JaCoCo插件一起用于Eclipse Tycho插件项目(或Cobertura)? [英] How do I make Jenkins, Sonar and the JaCoCo plugin work together for Eclipse Tycho Plugin Projects (or maybe Cobertura)?

查看:135
本文介绍了如何使Jenkins,Sonar和JaCoCo插件一起用于Eclipse Tycho插件项目(或Cobertura)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的设置是:

  • 詹金斯1.448
  • 声纳2.13
  • Jenkins声纳插件1.72
  • Sonar的MySql数据库

我有以下项目:

  • Eclipse插件项目
  • 使用Maven
  • 多个模块(父Maven项目,源插件项目,测试片段项目)
  • 一个简单的JUnit测试,用于测试源插件项目的类

目前的过程是什么

  • Jenkins从SVN签出父项目
  • Jenkins使用Maven和Tycho构建项目及其模块
  • Jenkins使用Surefire执行测试并生成报告
  • Jenkins使用Jenkins Sonar插件启动mvn sonar:sonar来执行代码分析
  • 对每个模块进行静态代码分析
  • JaCoCo失败

声纳具有可用的静态代码分析统计信息,并显示测试成功百分比. 唯一缺少的是JaCoCo的代码覆盖范围……甚至Cobertura的代码覆盖范围.

Sonar has static code analysis statistics available and test success percentage is shown. The only thing that's missing is JaCoCo's code coverage...or maybe even Cobertura's code coverage.

我现在并不在乎,我只想其中之一来产生代码覆盖率结果.

I don't really care at this point, I just want one of these things to produce code coverage results.

Cobertura似乎无法产生结果,可能是因为 -无法检测代码 -它在错误的位置查找已检测的代码 -它无法处理Tycho或单独的源代码/测试代码设置

Cobertura seems to be unable to produce results possibly because either - it can't instrument the code - it looks for the instrumented code at the wrong place - it can't cope with Tycho or the separate source/test code setup

JaCoCo应该能够即时监视代码覆盖率,但是其输出是

JaCoCo should be able to "watch" the code coverage on the fly, but its output is

[INFO] [17:44:04.708] Sensor JaCoCoSensor...
[INFO] [17:44:04.717] Project coverage is set to 0% as no JaCoCo execution data has been dumped: /var/lib/jenkins/jobs/testPlugin/workspace/testSource/target/jacoco.exec
[INFO] [17:44:04.854] Sensor JaCoCoSensor done: 146 ms

[INFO] [17:44:10.587] Sensor JaCoCoSensor...
[INFO] [17:44:10.587] Project coverage is set to 0% as no JaCoCo execution data has been dumped: /var/lib/jenkins/jobs/testPlugin/workspace/testTest/target/jacoco.exec
[INFO] [17:44:10.631] Sensor JaCoCoSensor done: 44 ms

[INFO] [17:44:12.402] Sensor JaCoCoSensor...
[INFO] [17:44:12.402] Project coverage is set to 0% as build output directory doesn't exists: /var/lib/jenkins/jobs/testPlugin/workspace/testParent/target/classes
[INFO] [17:44:12.402] Sensor JaCoCoSensor done: 0 ms

我做错了什么?我是否需要在我的pom.xml中启用JaCoCo?我需要开火吗?我需要做什么才能使用Cobertura?

What am I doing wrong? Do I need to enable JaCoCo in my pom.xml somewhere? Do I need surefire? What do I need to do to use Cobertura?

推荐答案

您可以看一下我几个月前写的博客文章:

You can have a look on the blog post I wrote few months ago : http://mdwhatever.free.fr/index.php/2011/09/quality-analysis-on-eclipse-plugins-with-tycho-sonar-jacoco-and-swtbot/

这篇关于如何使Jenkins,Sonar和JaCoCo插件一起用于Eclipse Tycho插件项目(或Cobertura)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆