我正在使用Jenkins 版本。1.466与Jenkins Cobertura 插件版本。1.5 . 我为 Django 项目生成了覆盖率报告。所有图表看起来都不错,但是当我想查看源代码时,我会收到警告消息:
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 run manage.py test --noinput
coverage xml -o ../reports/coverage.xml
我尝试使用:
sed 's/filename="/filename="my\/path\//g' coverage.xml > coverage2.xml
但没有帮助,Cobertura 插件没有找到不具有相对或绝对路径的源代码。
PS 如果我将源代码放入cobertura目录会出现一些奇怪的问题 - 显示源代码但未突出显示。