ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
454 stars 88 forks source link

Java example pom issues and failure in mvn install #415

Closed xenomorpheus closed 1 year ago

xenomorpheus commented 1 year ago

Describe the bug The java example fails the "mvn install". Many POM issues.

To Reproduce Steps to reproduce the behaviour:

  1. cd vscode-coverage-gutters/example/java/my-app
  2. mvn install
  3. See error at "Additional content"

Expected behaviour Maven install with no errors.

Screenshots Please see text at "Additional content"

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

As per the java/README.md, in a terminal run the following

mvn install -Dmaven.plugin.validation=VERBOSE

[INFO] Scanning for projects... [INFO] [INFO] ----------------------< com.mycompany.app:my-app >---------------------- [INFO] Building my-app 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- jacoco:0.8.2:prepare-agent (default) @ my-app --- [INFO] argLine set to -javaagent:/Users/the_user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/jacoco.exec [INFO] [INFO] --- resources:3.3.0:resources (default-resources) @ my-app --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/src/main/resources [INFO] [INFO] --- compiler:3.10.1:compile (default-compile) @ my-app --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/classes [INFO] [INFO] --- resources:3.3.0:testResources (default-testResources) @ my-app --- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/src/test/resources [INFO] [INFO] --- compiler:3.10.1:testCompile (default-testCompile) @ my-app --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! [INFO] Compiling 1 source file to /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/test-classes [INFO] [INFO] --- surefire:3.0.0:test (default-test) @ my-app --- [INFO] Using auto detected provider org.apache.maven.surefire.junit4.JUnit4Provider [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- Exception in thread "main" java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:491) at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:503) Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented. at org.jacoco.agent.rt.internal_28bab1d.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140) at org.jacoco.agent.rt.internal_28bab1d.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101) at org.jacoco.agent.rt.internal_28bab1d.PreMain.createRuntime(PreMain.java:55) at org.jacoco.agent.rt.internal_28bab1d.PreMain.premain(PreMain.java:47) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ... 3 more Caused by: java.lang.NoSuchFieldException: $jacocoAccess at java.base/java.lang.Class.getField(Class.java:2211) at org.jacoco.agent.rt.internal_28bab1d.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138) ... 7 more java.lang.instrument ASSERTION FAILED : "result" with message agent load/premain call failed at src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 422 /bin/sh: line 1: 93501 Abort trap: 6 '/usr/local/Cellar/openjdk/20.0.1/libexec/openjdk.jdk/Contents/Home/bin/java' '-javaagent:/Users/the_user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/jacoco.exec' '-jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire/surefirebooter-20230712210315832_3.jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire' '2023-07-12T21-03-15_718-jvmRun1' 'surefire-20230712210315832_1tmp' 'surefire_0-20230712210315832_2tmp' [INFO] [INFO] Results: [INFO] [INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 [INFO] [WARNING] Corrupted channel by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire-reports/2023-07-12T21-03-15_718-jvmRun1.dumpstream [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.180 s [INFO] Finished at: 2023-07-12T21:03:16+09:30 [INFO] ------------------------------------------------------------------------ [WARNING] [WARNING] Plugin validation issues were detected in 3 plugin(s) [WARNING] [WARNING] org.apache.maven.plugins:maven-compiler-plugin:3.10.1 [WARNING] Declared at location(s): [WARNING] org.apache.maven:maven-core:3.9.2:default-lifecycle-bindings @ line -1 [WARNING] Used in module(s): [WARNING] com.mycompany.app:my-app:1.0-SNAPSHOT (pom.xml) [WARNING] Plugin issue(s): [WARNING] Plugin should declare these Maven artifacts in provided scope: [org.apache.maven:maven-plugin-api:3.2.5, org.apache.maven:maven-model:3.2.5, org.apache.maven:maven-core:3.2.5, org.apache.maven:maven-settings:3.2.5, org.apache.maven:maven-model-builder:3.2.5, org.apache.maven:maven-repository-metadata:3.2.5, org.apache.maven:maven-aether-provider:3.2.5, org.apache.maven:maven-settings-builder:3.2.5, org.apache.maven:maven-artifact:3.2.5] [WARNING] [WARNING] org.apache.maven.plugins:maven-resources-plugin:3.3.0 [WARNING] Declared at location(s): [WARNING] org.apache.maven:maven-core:3.9.2:default-lifecycle-bindings @ line -1 [WARNING] Used in module(s): [WARNING] com.mycompany.app:my-app:1.0-SNAPSHOT (pom.xml) [WARNING] Mojo issue(s): [WARNING] Mojo resources:resources (org.apache.maven.plugins.resources.ResourcesMojo) [WARNING] - Implements Contextualizable interface from Plexus Container, which is EOL. [WARNING] Mojo resources:testResources (org.apache.maven.plugins.resources.TestResourcesMojo) [WARNING] - Implements Contextualizable interface from Plexus Container, which is EOL. [WARNING] [WARNING] org.jacoco:jacoco-maven-plugin:0.8.2 [WARNING] Declared at location(s): [WARNING] com.mycompany.app:my-app:1.0-SNAPSHOT (pom.xml) @ line 24 [WARNING] Used in module(s): [WARNING] com.mycompany.app:my-app:1.0-SNAPSHOT (pom.xml) [WARNING] Plugin issue(s): [WARNING] Plugin is a Maven 2.x plugin, which will be not supported in Maven 4.x [WARNING] Plugin depends on plexus-container-default, which is EOL [WARNING] [WARNING] [WARNING] Fix reported issues by adjusting plugin configuration or by upgrading above listed plugins. If no upgrade available, please notify plugin maintainers about reported issues. [WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE] [WARNING] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0:test (default-test) on project my-app: [ERROR] [ERROR] Please refer to /Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire-reports for the individual test results. [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream. [ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app' && '/usr/local/Cellar/openjdk/20.0.1/libexec/openjdk.jdk/Contents/Home/bin/java' '-javaagent:/Users/the_user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/jacoco.exec' '-jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire/surefirebooter-20230712210315832_3.jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire' '2023-07-12T21-03-15_718-jvmRun1' 'surefire-20230712210315832_1tmp' 'surefire_0-20230712210315832_2tmp' [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 134 [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called? [ERROR] Command was /bin/sh -c cd '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app' && '/usr/local/Cellar/openjdk/20.0.1/libexec/openjdk.jdk/Contents/Home/bin/java' '-javaagent:/Users/the_user/.m2/repository/org/jacoco/org.jacoco.agent/0.8.2/org.jacoco.agent-0.8.2-runtime.jar=destfile=/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/jacoco.exec' '-jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire/surefirebooter-20230712210315832_3.jar' '/Users/the_user/git/Java_Projects/vscode-coverage-gutters/example/java/my-app/target/surefire' '2023-07-12T21-03-15_718-jvmRun1' 'surefire-20230712210315832_1tmp' 'surefire_0-20230712210315832_2tmp' [ERROR] Error occurred in starting fork, check output in log [ERROR] Process Exit Code: 134 [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:643) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:285) [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:250) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1203) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1055) [ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:871) [ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:342) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:330) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:175) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.access$000(MojoExecutor.java:76) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor$1.run(MojoExecutor.java:163) [ERROR] at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute(DefaultMojosExecutionStrategy.java:39) [ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:160) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:105) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:73) [ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:53) [ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:118) [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:261) [ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:173) [ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:101) [ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:910) [ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:283) [ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:206) [ERROR] at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) [ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:578) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:283) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:226) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:407) [ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:348) [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionExceptionthe_user

xenomorpheus commented 1 year ago

Please see pull request here https://github.com/ryanluker/vscode-coverage-gutters/pull/416 Fixed issue for me.

Also seen on stackoverflow https://stackoverflow.com/questions/61140209/error-when-executing-tests-in-java-maven-jacoco-failed-to-execute-goal-org-apac

ryanluker commented 1 year ago

Please see pull request here #416 Fixed issue for me.

Also seen on stackoverflow https://stackoverflow.com/questions/61140209/error-when-executing-tests-in-java-maven-jacoco-failed-to-execute-goal-org-apac

Good find and PR, I will merge shortly. Thanks as well for the contribution!