在java maven jacoco中执行测试时出错:未能执行目标组织。阿帕奇。专家插件:maven surefire插件:2.12.4:测试
早上好我正在执行一个Maven项目,我使用NetBeans编写Java代码。当我尝试运行测试文件时,会出现以下错误:
cd C:\Users\ruimi\Documents\NetBeansProjects\erro_testes_unitarios; "JAVA_HOME=C:\\Program Files\\Java\\jdk-14" cmd /c "\"C:\\Program Files\\netbeans 11.3 tenativa 1000\\NetBeans-11.3\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dtest=com.mycompany.erro_testes_unitarios.NewMainTest -Dmaven.ext.class.path=\"C:\\Program Files\\netbeans 11.3 tenativa 1000\\NetBeans-11.3\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 test-compile surefire:test"
Scanning for projects...
------------------------------------------------------------------------
Building erro_testes_unitarios 1.0-SNAPSHOT
------------------------------------------------------------------------
--- jacoco-maven-plugin:0.7.7.201606060606:prepare-agent (default) @ erro_testes_unitarios ---
argLine set to -javaagent:C:\\Users\\ruimi\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.7.7.201606060606\\org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=C:\\Users\\ruimi\\Documents\\NetBeansProjects\\erro_testes_unitarios\\target\\jacoco.exec
--- maven-resources-plugin:2.6:resources (default-resources) @ erro_testes_unitarios ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\ruimi\Documents\NetBeansProjects\erro_testes_unitarios\src\main\resources
--- maven-compiler-plugin:3.1:compile (default-compile) @ erro_testes_unitarios ---
Nothing to compile - all classes are up to date
--- maven-resources-plugin:2.6:testResources (default-testResources) @ erro_testes_unitarios ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\ruimi\Documents\NetBeansProjects\erro_testes_unitarios\src\test\resources
--- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ erro_testes_unitarios ---
Nothing to compile - all classes are up to date
--- maven-surefire-plugin:2.12.4:test (default-cli) @ erro_testes_unitarios ---
Surefire report directory: C:\Users\ruimi\Documents\NetBeansProjects\erro_testes_unitarios\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
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:564)
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/util/UUID could not be instrumented.
at org.jacoco.agent.rt.internal_6da5971.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:140)
at org.jacoco.agent.rt.internal_6da5971.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:101)
at org.jacoco.agent.rt.internal_6da5971.PreMain.createRuntime(PreMain.java:55)
at org.jacoco.agent.rt.internal_6da5971.PreMain.premain(PreMain.java:47)
... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
at java.base/java.lang.Class.getField(Class.java:2013)
at org.jacoco.agent.rt.internal_6da5971.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:138)
... 9 more
*** java.lang.instrument ASSERTION FAILED ***: "result" with message agent load/premain call failed at JPLISAgent.c line: 422
FATAL ERROR in native method: processing of -javaagent failed, processJavaStart failed
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.899 s
Finished at: 2020-04-10T13:14:06+01:00
Final Memory: 11M/47M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-cli) on project erro_testes_unitarios: Execution default-cli of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
这是我的pom.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>erro_testes_unitarios</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
你能帮我吗?谢谢大家的可用性!
显然,您正在使用JDK14作为您的开发和测试环境。您可以检查它。转到帮助-
Jacoco仅在0.8.5版本中添加了对JDK 14的实验支持:
JaCoCo现在正式支持Java 13
您可以将插件版本更改为0.8.5:
...
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
...
0.7.7版本支持JDK 8或更早版本。所以,如果你想使用0.7.7版本的插件,你可以使用JDK 8。要为NetBeans设置JDK版本,请参见问题。还有JDK 8,你应该改变maven。编译器。来源和maven。编译器。目标为1.8
这是我的pom。xml文件, 我使用eclipse,使用run as→maven build,这是我的错误信息, 结果: 错误测试: nodeCreationwith Label(neo4j.tests.Neo4jTest): org/neo4j/内核/impl/util/函数/选项$Lazy可选nodeCreationwith Label(neo4j.tests.Neo4jTest)comare
运行Maven测试时出现此错误 执行目标组织失败。阿帕奇。专家插件:maven插件插件:3.2:项目amsframeworok上的描述符(默认描述符):提取插件描述符时出错:“未找到插件:ams5的mojo定义。0:amsframeworok。'- 下面是我的pom。xml
我在maven surefire插件3.0.0-M4和maven版本3.6.3、3.6.0和3.3.9以及jdk1中遇到了这个问题。8.0_222(Ubuntu 18.0.4)。我的pom。xml如下所示: 詹金斯的产出如下:
来自Eclipse火星版,pom。xml-Run-As-maven-clean,我得到了以下关于构建失败的错误消息 [ERROR]无法执行目标组织。阿帕奇。专家插件:maven clean插件:2.5:项目测试框架上的clean(默认清洁):目标组织的执行默认清洁。阿帕奇。专家插件:maven clean插件:2.5:clean失败:插件组织。阿帕奇。专家plugins:maven clean p
我正在做一个端到端的项目,包括后端和前端。前端工作正常(angular2框架、“npm启动”和“ng构建”工作正常)。但是,当我从project home文件夹运行“mvn clean install”时,它会给我一个错误,我对此一无所知: 在project home文件夹下,我可以成功运行“mvn compile”,但不能运行“mvn clean install”。它显示前端故障,并显示上面的错
执行目标组织失败。阿帕奇。专家插件:maven surefire插件:2.5-r682619-maestro-2.0.0:project ms61 webservice xxxx上的测试(默认测试):存在测试失败。这意味着什么以及如何解决它。我第一次做maven build。