I'm now facing some problem with maven clover plugin, I have 2 separate maven projects: one from DEV and one from QA, and they are executed on different hosts, details:
host1: a Windows host where I instrument DEV's source code and build project(DEV's maven project)
<plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-clover2-plugin</artifactId> <version>${clover.version}</version> <configuration> <license>xxx</license> <singleCloverDatabase>true</singleCloverDatabase> <cloverDatabase>${project.home.dir}/clover.db</cloverDatabase> <includesTestSourceRoots>false</includesTestSourceRoots> <excludes>xxx</excludes> </configuration> </plugin>
host2: a Linux host where I run integration tests and generate report(QA's maven project)
<plugin> <groupId>com.atlassian.maven.plugins</groupId> <artifactId>maven-clover2-plugin</artifactId> <version>${clover.version}</version> <configuration> <license>xxx</license> <contextFilters>logger, iflogger, log, iflog</contextFilters> <generateXml>true</generateXml> <generateHtml>true</generateHtml> <cloverDatabase>../DEV/clover.db</cloverDatabase> <outputDirectory>target/surefire-reports/clover</outputDirectory> </configuration> <executions> <execution> <id>site</id> <phase>pre-site</phase> <goals> <goal>clover</goal> <goal>save-history</goal> </goals> </execution> </executions> </plugin>
The problem is:
After I copy the build file with instrumented classes and clover database from host1 to host2, then I execute test and generate clover report on host2 by executing command: mvn test clover2:clover, following error return, D:/perforce/depot/..../example.java is the location on host1 where source code place.
[ERROR] Failed to render syntax highlights for /app/QA/D:/perforce/depot/..../example.java: D:/perforce/depot/..../example.java (No such file or directory)
java.io.FileNotFoundException: D:/perforce/depot/..../example.java (No such file or directory)java.io.FileNotFoundException: D:/perforce/depot/Solutions/EAS/eas/Main/core/eas-service/src/main/java/com/emc/documentum/eas/service/order/EnumerateOrdersService.java (No such file or directory)
I'm wondering is there any solution can resolve my problem?
Anyone who meet the same problem, please go https://jira.atlassian.com/browse/CLOV-1415for the solution.
Hello,
Im trying to use command line tool to generate report as below:
java -Dclover.license.path=../resources/clover.license -classpath ../lib/clover-3.2.1.jar com.atlassian.clover.reporters.html.HtmlReporter -p ../lib -i clover-proj.db -o clover_html
But am getting these errors:
ERROR: Failed to render syntax highlights for <myserver/path/to/myclass.java>: <myserver/path/to/myclass.java>: (No such file or directory)
Looks like the path for java files is hardcoded ...I tried using "-p" option to point to location where the source code jars are present, but that doesn't work. We cannot generate report on server (where src code is present) ..is there a way to get the syntax highlighting working in this case?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried using "-p" option to point to location where the source code jars are present
Please do not use JARs. Clover does not read sources from archives.
Instead of this, please point to a directory containing source files.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The team generating the report, have access only to
1. clover.db
2. coverage files
3. clover-3.2.1.jar and
4. clover.license.
They do not have source code in their environment.. what do we do now?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use HtmlReporter with the '--hidesrc' option - it will not render source pages.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was looking for source highlighting (which lines were hit and which did not), but I guess there is no way to do without access to source files. Anyways, thanks for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We tried giving the path to the .java source files using "-p" option . But report generation still looks for the files in the build path. For example:
While intrumenting if the files were at a/b/file.java. Generate report with '-p x/y/file.java'. But it fails saying cannot find '/a/b/file.java/' ..How do we overrite this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Generate report with '-p x/y/file.java'
You should not point to a source file, but to a root directory (or directories). For example, if during instrumentation sources were present in directories:
/build/projectA/src/main/java
/build/projectA/src/test/java
(e.g. /build/projectA/src/main/java/com/acme/A.java)
and during report generation these sources are in:
/reporting/projectA/src/main/java
/reporting/projectA/src/test/java
then you shall use:
HtmlReporter -p "/reporting/projectA/src/main/java:/reporting/projectA/src/test/java" ...
Note: use ":" for Linux and ";" for Windows.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I checked again and found that I used only paths and not exact file names.
Why is it still looking for sources in build path?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If Clover uses the original build path, then it means that it doesn't see sources under a path(s) provided by you. Are you sure that you're using correct source roots?
You can run Clover with debug logging (ant -d / mvn -X / HtmlReporter -d) and look for messages like:
"looking for /com/acme/MyClass.java (FOUND|not found)"
"/com/acme/MyClass.java not found on path"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A problem is indeed similar to CLOV-1112, but it's not caused by a bug in later Clover versions, but by a fact that the Maven clover2:clover goal does not pass the "sourcepath" property to the report task. Unfortunately, there's no "sourcepath" configuration option for the clover2:clover goal.
Issue report:
An improvement for it is reported here: https://jira.atlassian.com/browse/CLOV-1415.
Workaround:
Use a custom report configuration:
1. Define the clover2:clover reportDescriptor tag in pom.xml, pointing to a file with a custom report configuration.
2. Define a custom report configuration as per Creating+custom+reports guideline. You can use any of the options available for <clover-report> task in it.
3. In this custom report configuration define the <sourcepath> element for the <clover-report> tasks defined in "current" and "historical" targets.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using Clover 3.1.10, the problem I'm facing now is exactly match what described in CLOV-1112, instrument on Windows and generate report on linux, db file record each source file's absolute path, which resulting win-linux paths like:
[ERROR] Failed to render syntax highlights for /app/QA/D:/perforce/depot/..../example.java
As you mentioned CLOV-1112 is mark as resloved in 3.1.7, but now seems it's still reproducible in 3.1.10.
BTW, I'm using clover maven plugin, details please check my post:
https://answers.atlassian.com/questions/251117/is-source-code-location-hardcode-in-clover-registry-file,
Thanks,
Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.