Jenkins Cobertura plugin “Source code is unavailable”

流过昼夜 提交于 2019-12-08 17:21:17

问题


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

I tried to use:

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

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

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


回答1:


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

coverage xml -o 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.




回答2:


Do you have "Discard Old Builds" checked or some kind of reclone and start from scratch option? If not you may want to look into archiving artifacts and add your coverage file to the list.



来源:https://stackoverflow.com/questions/10815617/jenkins-cobertura-plugin-source-code-is-unavailable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!