Details
-
Bug
-
Resolution: Won't Fix
-
Medium
-
3.1.10
-
None
-
clover maven plugin, instrument on Windows, test and generate report on Linux
-
Severity 2 - Major
Description
Original problem from the cloned issue:
Clover database contains FileInfo objects for every source file. One of FileInfo fields is an absolute path to given file. When database is written, it uses current platform file separator for file name ('\' for windows, '/' for Linux/MacOS). However, when database is read it interprets file name using again current platform file separator.
As a consequence, when database is generated on Windows and report generated on Linux, it cannot resolve file name properly - it takes whole path as a single path segment, resulting in paths like:
/path/from/report/generation/sourcepath/D:/path/from/instrumented/build/file.java
As a consequence report generation does create html file containing source code with highlighted coverage.
Problem with the clover2:clover goal:
The clover2:clover call <clover-report> using a default report descriptor (which is located in the maven-clover2-plugin-X.X.X.jar/default-clover-report.xml). This report descriptor has a reporting defined like:
<current outfile="${output}" summary="${summary}" charset="${charset}" title="${title}" titleAnchor="${titleAnchor}" span="${span}" alwaysReport="${alwaysReport}" showInnerFunctions="${showInnerFunctions}" showLambdaFunctions="${showLambdaFunctions}"> <format refid="clover.format"/> <testsources refid="test.sources"/> <columns refid="clover.columns"/> </current>
i.e. there is no <sourcepath> property.
Possible fix #1:
- add the <sourcepath> property
- set it's value to a list of standard source roots, similarly as it's done for <testsources> tag
excerpt from the CloverReportMojo:
antProject.setProperty("testPattern", "**/src/test/**");
excerpt from the default-clover-report.xml:
<fileset id="test.sources" dir="${projectDir}"> <include name="${testPattern}"/> </fileset> ... <testsources refid="test.sources"/>
so it could be like this:
antProject.setProperty("sourceRootsPattern", "**/src/test/*;**/src/main/*"); ...
potential problem: build may have source roots different than src/test/xxx and src/main/xxx; in such case sources would not be found; it means that settings this <sourcepath> property should be optional; it could be done via boolean flag
Possible fix #2:
- add the <sourcepath> property to the clover2:clover goal
- if it's not null then pass it's value to the <sourcepath> property in the <clover-report> goal in the report descriptor
potential problem: how developers could easily find all source roots in all modules in their maven project in order to pass it as the property?
Attachments
Issue Links
- is cloned from
-
CLOV-1112 Reading clover database across platforms does not resolve path correctly for FileInfo
- Closed