-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClassNotFoundException for CloverCompilerAdapter when using OpenClover 4.3.1 on a Java project #125
Comments
I have to do some work for adding support for the 4.3.1 Clover. It includes support for Java 9+ which I would like to include. I cannot promise I will get to it soon, but I will try. |
@Alex-Vol-SV seems to be a classloader issue, most-likely similar to [4.3.1] Ant javac task is unable to find CloverCompilerAdapter class. They list a workaround:
I've tried the workaround, but it doesn't seem to make a difference for Side-noteInitially I thought this would be a trivial upgrade for But I can see that Java-tests fails with or without the suggested work-around from OpenClover :/
Any hints? :) |
I know where this has to change. I will have to add the clover jar to the classpath instead of the bootclasspath. Prior to Java 9 this was the preferred way but now it must be in the compiler classpath. |
@Alex-Vol-SV wrote
Thanks for the hint :) Snippets from InstrumentCodeAction.groovy referencing Line 309
Note: adding Line 331
Of all the references I've reviewed, the above seems to be the most-likely regarding the Java issue, unfortunately it already references |
I tried a few things and this still is not solved. Injecting the Clover JAR in the correct classpath is not as easy as I thought. I will keep trying to see if there is a way to solve this without major overhaul. |
I was able to get this to work by enabling the javac includeAntRuntime flag and adding clover.jar in the $HOME/.ant/lib directory of the system. I am very much against such a solution but I may resort to enabling this as a new clover configuration so users can choose to use it if they find it acceptable. I will continue looking for a better answer because this is rather awkward to implement in a CI system. I would hesitate to force every build slave in a CI to have preinstalled copies of Clover JAR everywhere. |
Running the cloverGenerateReport task on a simple Java project configured with version 2.2.1 of the plugin, and version 4.3.1 of OpenClover (both newest at the time of this writing) throws the following exception:
I am using Java 8 and Gradle 5.1.1.
It looks like the plugin is not compatible with that version of OpenClover, likely due to the fix for https://bitbucket.org/openclover/clover/issues/75. In that issue, it states that a work-around is to add the OpenClover jar file to the lib folder for Ant, which is of cause not going to work in a Gradle plugin. So I have no idea how to fix this :(
The plugin works on the same project if I downgrade to OpenClover 4.2.1. It also works if the project only contains Groovy sources (and these get instrumented correctly as well).
Here is my Gradle build file for reference:
The text was updated successfully, but these errors were encountered: