Re: JaCoCoverage plugin
You might be hitting this with Gradle: https://github.com/vaskoz/core-java9-impatient/issues Also are you trying to use Java modular projects? That's not working with the current plugin. On 5/25/19 2:04 AM, Eduardo Mosqueira Rey wrote: With Maven I managed to get the coverage data adding this plugin to the pom: org.jacoco jacoco-maven-plugin 0.8.2 prepare-agent report test report The problem is that it forces the students to look under the hood in the project structure. Also I missed the branch coverage information. It seems to be counting only line coverage, as far as I know. With Gradle I cannot even run the tests. I am not a Gradle user so maybe I missed something. Here it is the output: JAVA_HOME="C:\Program Files\Java\jdk-11.0.2" cd C:\Users\Eduardo\Documents\NetBeansProjects\gradleproject1; C:\Users\Eduardo\.gradle\wrapper\dists\gradle-4.10.2-bin\cghg6c4gf4vkiutgsab8yrnwv\gradle-4.10.2\bin\gradle --configure-on-demand --rerun-tasks -x check test Configuration on demand is an incubating feature. > Task :compileJava > Task :processResources NO-SOURCE > Task :classes > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses Could not write standard input to Gradle Test Executor 1. java.io.IOException: Se est cerrando la canalizacin at java.base/java.io.FileOutputStream.writeBytes(Native Method) at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354) at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:66) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:51) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.base/java.lang.Thread.run(Thread.java:834) > Task :test FAILED Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.FATAL ERROR in native method: processing of -javaagent failed at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101) at org.jacoco.agent.rt.internal_c13123e.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_c13123e.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:2000) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) ... 9 more *De:* Laszlo Kishalmi *Enviado:* sábado, 25 de mayo de 2019 1:49 *Para:* users@netbeans.apache.org *Asunto:* Re: JaCoCoverage plugin Hi! Actually JaCoCo support is out-of-the box in NetBeans, the additional plugin was required for Ant Based projects and it is not maintained right now (AFAIK it still has to be contributed by Oracle to Apache) So JaCoCo with Maven project do work though it require some configuration in the pom.xml. I'd say the easiest way is to achieve it if you just create a new Gradle Project from the IDE: File > New Project > Java with Gradle > Java Application | Java Class Library The new project will be created with Gradle's Jacoco plugin applied. NetBeans
Re: JaCoCoverage plugin
Bos días, Eduardo, all, You're using JDK11 or JDK12, right? It seems you'll have to upgrade the jacoco version in your pom.xml, as JBoss is doing in [1]. This looks very similar to the error you're getting. They've upgraded to 0.8.2 [2]. AFAIK jacoco 0.8.0 has only _experimental_ support for JDK11 and JDK12. Unha aperta, Antonio [1] https://issues.jboss.org/browse/JBIDE-26336?_sscc=t [2] https://github.com/jbosstools/jbosstools-build/blob/master/parent/pom.xml#L893 El 25/5/19 a las 11:26, Eduardo Mosqueira Rey escribió: Just for clarify the branch coverage is in the full report at "\target\site\jacoco\index.html" what I missed was that information in the NetBeans GUI. *De:* Eduardo Mosqueira Rey *Enviado:* sábado, 25 de mayo de 2019 11:04 *Para:* Laszlo Kishalmi; users@netbeans.apache.org *Asunto:* RE: JaCoCoverage plugin With Maven I managed to get the coverage data adding this plugin to the pom: org.jacoco jacoco-maven-plugin 0.8.2 prepare-agent report test report The problem is that it forces the students to look under the hood in the project structure. Also I missed the branch coverage information. It seems to be counting only line coverage, as far as I know. With Gradle I cannot even run the tests. I am not a Gradle user so maybe I missed something. Here it is the output: JAVA_HOME="C:\Program Files\Java\jdk-11.0.2" cd C:\Users\Eduardo\Documents\NetBeansProjects\gradleproject1; C:\Users\Eduardo\.gradle\wrapper\dists\gradle-4.10.2-bin\cghg6c4gf4vkiutgsab8yrnwv\gradle-4.10.2\bin\gradle --configure-on-demand --rerun-tasks -x check test Configuration on demand is an incubating feature. > Task :compileJava > Task :processResources NO-SOURCE > Task :classes > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses Could not write standard input to Gradle Test Executor 1. java.io.IOException: Se est cerrando la canalizacin at java.base/java.io.FileOutputStream.writeBytes(Native Method) at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354) at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:66) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:51) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.base/java.lang.Thread.run(Thread.java:834) > Task :test FAILED Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.FATAL ERROR in native method: processing of -javaagent failed at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101) at org.jacoco.agent.rt.internal_c13123e.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_c13123e.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:2000) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) ... 9 more -
RE: JaCoCoverage plugin
Just for clarify the branch coverage is in the full report at "\target\site\jacoco\index.html" what I missed was that information in the NetBeans GUI. De: Eduardo Mosqueira Rey Enviado: sábado, 25 de mayo de 2019 11:04 Para: Laszlo Kishalmi; users@netbeans.apache.org Asunto: RE: JaCoCoverage plugin With Maven I managed to get the coverage data adding this plugin to the pom: org.jacoco jacoco-maven-plugin 0.8.2 prepare-agent report test report The problem is that it forces the students to look under the hood in the project structure. Also I missed the branch coverage information. It seems to be counting only line coverage, as far as I know. With Gradle I cannot even run the tests. I am not a Gradle user so maybe I missed something. Here it is the output: JAVA_HOME="C:\Program Files\Java\jdk-11.0.2" cd C:\Users\Eduardo\Documents\NetBeansProjects\gradleproject1; C:\Users\Eduardo\.gradle\wrapper\dists\gradle-4.10.2-bin\cghg6c4gf4vkiutgsab8yrnwv\gradle-4.10.2\bin\gradle --configure-on-demand --rerun-tasks -x check test Configuration on demand is an incubating feature. > Task :compileJava > Task :processResources NO-SOURCE > Task :classes > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses Could not write standard input to Gradle Test Executor 1. java.io.IOException: Se est cerrando la canalizacin at java.base/java.io.FileOutputStream.writeBytes(Native Method) at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354) at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:66) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:51) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.base/java.lang.Thread.run(Thread.java:834) > Task :test FAILED Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.FATAL ERROR in native method: processing of -javaagent failed at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101) at org.jacoco.agent.rt.internal_c13123e.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_c13123e.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:2000) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) ... 9 more De: Laszlo Kishalmi Enviado: sábado, 25 de mayo de 2019 1:49 Para: users@netbeans.apache.org Asunto: Re: JaCoCoverage plugin Hi! Actually JaCoCo support is out-of-the box in NetBeans, the additional plugin was required for Ant Based projects and it is not maintained right now (AFAIK it still has to be contributed by Oracle to Apache) So JaCoCo with Maven project do work though it require some configuration in the pom.xml. I'd say the easiest way is to achieve it if you just create a new Gradle Project from the IDE: File > New Project > Java with Gradle > Java Application | Java Class Library The ne
RE: JaCoCoverage plugin
With Maven I managed to get the coverage data adding this plugin to the pom: org.jacoco jacoco-maven-plugin 0.8.2 prepare-agent report test report The problem is that it forces the students to look under the hood in the project structure. Also I missed the branch coverage information. It seems to be counting only line coverage, as far as I know. With Gradle I cannot even run the tests. I am not a Gradle user so maybe I missed something. Here it is the output: JAVA_HOME="C:\Program Files\Java\jdk-11.0.2" cd C:\Users\Eduardo\Documents\NetBeansProjects\gradleproject1; C:\Users\Eduardo\.gradle\wrapper\dists\gradle-4.10.2-bin\cghg6c4gf4vkiutgsab8yrnwv\gradle-4.10.2\bin\gradle --configure-on-demand --rerun-tasks -x check test Configuration on demand is an incubating feature. > Task :compileJava > Task :processResources NO-SOURCE > Task :classes > Task :compileTestJava > Task :processTestResources NO-SOURCE > Task :testClasses Could not write standard input to Gradle Test Executor 1. java.io.IOException: Se est cerrando la canalizacin at java.base/java.io.FileOutputStream.writeBytes(Native Method) at java.base/java.io.FileOutputStream.write(FileOutputStream.java:354) at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81) at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142) at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:66) at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:51) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.base/java.lang.Thread.run(Thread.java:834) > Task :test FAILED Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525) Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.FATAL ERROR in native method: processing of -javaagent failed at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101) at org.jacoco.agent.rt.internal_c13123e.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_c13123e.PreMain.premain(PreMain.java:47) ... 6 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:2000) at org.jacoco.agent.rt.internal_c13123e.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) ... 9 more De: Laszlo Kishalmi Enviado: sábado, 25 de mayo de 2019 1:49 Para: users@netbeans.apache.org Asunto: Re: JaCoCoverage plugin Hi! Actually JaCoCo support is out-of-the box in NetBeans, the additional plugin was required for Ant Based projects and it is not maintained right now (AFAIK it still has to be contributed by Oracle to Apache) So JaCoCo with Maven project do work though it require some configuration in the pom.xml. I'd say the easiest way is to achieve it if you just create a new Gradle Project from the IDE: File > New Project > Java with Gradle > Java Application | Java Class Library The new project will be created with Gradle's Jacoco plugin applied. NetBeans recognize that, so right clicking the project there will be a Code Coverage menu where you can enable the collection of the coverage results. From that point whenever some unit tests were executed the code coverage results would be updated. on 5/24/19 3:54 PM,