Jenkins Cobertura插件“源代码不可用" [英] Jenkins Cobertura plugin "Source code is unavailable"

查看:259
本文介绍了Jenkins Cobertura插件“源代码不可用"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Jenkins版本. Jenkins Cobertura Plugin ver.1.466 . 1.5 .我为Django项目生成了覆盖率报告.所有图表看起来都不错,但是当我想查看源代码时,会显示警告消息:

I'm using Jenkins ver. 1.466 with Jenkins Cobertura Plugin ver. 1.5. I generated coverage report for Django project. All charts looks good, but when I want to see source code I have warning message:

Source code is unavailable. Some possible reasons are:
    This is not the most recent build (to save on disk space, this plugin only keepsthe     most recent builds source code).
    Cobertura found the source code but did not provide enough information to locate the source code.
    Cobertura could not find the source code, so this plugin has no hope of finding it.

使用以下步骤生成覆盖率报告:

Coverage report is generated using these steps:

coverage run manage.py test --noinput
coverage xml -o ../reports/coverage.xml

我尝试使用:

sed 's/filename="/filename="my\/path\//g' coverage.xml > coverage2.xml

但没有帮助,Cobertura插件找不到没有相对或绝对路径的源代码.

but didn't help, Cobertura plugin didn't find source code not with relative or absolute path.

P.S.如果将源代码放入 cobertura 目录中,则会出现一些奇怪的问题-源代码会显示但不会突出显示.

P.S. Some strange issue if I put source code into the cobertura directory - source code is displayed but not highlighted.

推荐答案

输出xml文件必须与运行coverage的文件夹位于同一文件夹中,因此:

The output xml file has to be in the same folder as where coverage is run, so:

coverage xml -o coverage.xml

对源文件夹的引用被放入coverage.xml,并且如果将输出文件放入另一个文件夹,则对源文件夹的引用将不正确.

The reference to the source folder is put into coverage.xml and if the output file is put into another folder, the reference to the source folder will be incorrect.

这篇关于Jenkins Cobertura插件“源代码不可用"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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