bmuschko / gradle-clover-plugin

Gradle plugin for generating a code coverage report using Clover
Apache License 2.0
74 stars 49 forks source link

Trying to update to 2.2.2 and 4.3.1 gives errors #134

Closed freshcodemonger closed 5 years ago

freshcodemonger commented 5 years ago

I get these errors unless I use org.openclover:clover:4.2.0. I tried doing a clean and build. I also tried removing the /var/folders/0r directory that was referenced below. I made sure the .clover directory in my project was deleted before running.

[ant:javac] symbol: method An_old_version_of_clover_is_on_your_compilation_classpath_Please_remove___Required_versionis4_2_0() [ant:javac] location: class CloverVersionInfo [ant:javac] /var/folders/0r/vl1jrr3x01lbfrtktgxfn1k00000gn/T/clover989017247972655426.tmp/com....java:10: error: cannot find symbol logfile:[ant:javac] {public static class CLR4_2_0n5yn5yju3o00ms{public static com_atlassian_clover.CoverageRecorder R;public static com_atlassian_clover.CloverProfile[] profiles = { };@java.lang.SuppressWarnings("unchecked") public static <I, T extends I> I lambdaInc(final int i,final T l,final int si){java.lang.reflect.InvocationHandler h=new java.lang.reflect.InvocationHandler(){public java.lang.Object invoke(java.lang.Object p,java.lang.reflect.Method m,java.lang.Object[] a) throws Throwable{R.inc(i);R.inc(si);try{return m.invoke(l,a);}catch(java.lang.reflect.InvocationTargetException e){throw e.getCause()!=null?e.getCause():new RuntimeException("Clover failed to invoke instrumented lambda",e);}}};return (I)java.lang.reflect.Proxy.newProxyInstance(l.getClass().getClassLoader(),l.getClass().getInterfaces(),h);}static{com_atlassian_clover.CoverageRecorder _R=null;try{com_atlassian_clover.CloverVersionInfo.An_old_version_of_clover_is_on_your_compilation_classpath_PleaseremoveRequired_versionis4_2_0();if(20170430005756651L!=com_atlassian_clover.CloverVersionInfo.getBuildStamp()){com_atlassian_clover.Clover.l("[CLOVER] WARNING: The Clover version used in instrumentation does not match the runtime version. You need to run instrumented classes against the same version of Clover that you instrumented with.");com_atlassian_clover.Clover.l("[CLOVER] WARNING: Instr=4.2.0#20170430005756651,Runtime="+com_atlassian_clover.CloverVersionInfo.getReleaseNum()+"#"+com_atlassian_clover.CloverVersionInfo.getBuildStamp());}R=com_atlassian_clover.Clover.getNullRecorder();_R=com_atlassian_clover.Clover.getNullRecorder();_R=com_atlassian_clover.Clover.getRecorder("\u002f\u0055\u0073\u0065\u0072\u0073\u002f\u0072\u006d\u002f\u0044\u0065\u0073\u006b\u0074\u006f\u0070\u002f\u0053\u0068\u0061\u0072\u0065\u0064\u0053\u0074\u0075\u0066\u0066\u002f\u0067\u0069\u0074\u002f\u0062\u0063\u0069\u0074\u002f\u0067\u006a\u0037\u0038\u0036\u002f\u0062\u0075\u0069\u006c\u0064\u002f\u002e\u0063\u006c\u006f\u0076\u0065\u0072\u002f\u0063\u006c\u006f\u0076\u0065\u0072\u002e\u0064\u0062\u002d\u0074\u0065\u0073\u0074",1554444296151L,1000L,30044,profiles,new java.lang.String[]{"clover.distributed.coverage",null});}catch(java.lang.SecurityException e){java.lang.System.err.println("[CLOVER] FATAL ERROR: Clover could not be initialised because it has insufficient security privileges. Please consult the Clover documentation on the security policy file changes required. ("+e.getClass()+":"+e.getMessage()+")");}catch(java.lang.NoClassDefFoundError e){java.lang.System.err.println("[CLOVER] FATAL ERROR: Clover could not be initialised. Are you sure you have Clover in the runtime classpath? ("+e.getClass()+":"+e.getMessage()+")");}catch(java.lang.Throwable t){java.lang.System.err.println("[CLOVER] FATAL ERROR: Clover could not be initialised because of an unexpected error. ("+t.getClass()+":"+t.getMessage()+")");}R=_R;}}public static final com_atlassian_clover.TestNameSniffer CLR4_2_0_TEST_NAME_SNIFFER=com_atlassian_clover.TestNameSniffer.NULL_INSTANCE; logfile:[ant:javac] symbol: method An_old_version_of_clover_is_on_your_compilationclasspathPlease_remove_Required_versionis4_2_0() logfile:[ant:javac] location: class CloverVersionInfo

Alex-Vol-SV commented 5 years ago

You should clean your build directory. It appears there is code instrumented with clover 4.2.0 attempting to compile together with code using 4.3.1. Are you perhaps building multiple instrumented JAR files and using an instrumented JAR file as a dependency to the compile of this one?

Alex-Vol-SV commented 5 years ago

Do you have a compile dependency injected via transitive JAR file dependencies? You can tell by running ./gradlew dependencies on the project that fails. It is possible you added a gradle dependency to clover as compile in your build.gradle for another JAR file and you are causing that to pull Clover 4.2.0 into the runtime path.

freshcodemonger commented 5 years ago

Thanks, I'll debug some more on my side.

freshcodemonger commented 5 years ago

Seems to work now. I tried doing clean builds before so I wonder if it was some artifact of the reuse of gradle daemons or something and now it has picked up a new daemon. Not sure what else to attribute this to.