运行 Maven Surefire 测试插件 Java 11 时出错

2024-05-02

我正在使用 Maven Surefire 插件版本 2.22.1 在 Team City 中运行 Spring Boot 应用程序的一些测试。 Spring Boot 版本是 2.1.2。我在配置中指定使用分叉的 Java 11 jvm,如下所示:

            <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <forkCount>1</forkCount>
                <jvm>${jdk11.home}/bin/java</jvm>
                <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
            </configuration>
        </plugin>

运行 Team City 时,我在日志中收到错误:

    [11:07:59][Step 6/6] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project ep-elm-web: There are test failures.
[11:07:59][Step 6/6] [ERROR] 
[11:07:59][Step 6/6] [ERROR] Please refer to /opt/*******/buildAgent/work/3c34aba90580ae72/ep-elm-web/target/surefire-reports for the individual test results.
[11:07:59][Step 6/6] [ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[11:07:59][Step 6/6] [ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[11:07:59][Step 6/6] [ERROR] Command was /bin/sh -c cd /opt/*******/buildAgent/work/3c34aba90580ae72/ep-elm-web && /opt/jdk-11.0.2/bin/java -Xmx1024m -XX:MaxPermSize=256m -javaagent:/opt/*******/buildAgent/tools/jacoco.0.7.5/jacocoagent.jar=append=true,destfile=/opt/*******/buildAgent/temp/buildTmp/JACOCO158546265956865605coverage/jacoco.exec org.apache.maven.surefire.booter.ForkedBooter /opt/*******/buildAgent/work/3c34aba90580ae72/ep-elm-web/target/surefire 2019-02-20T11-07-58_396-jvmRun1 surefire6001620761776512056tmp surefire_02647190773594316116tmp
[11:07:59][Step 6/6] [ERROR] Error occurred in starting fork, check output in log
[11:07:59][Step 6/6] [ERROR] Process Exit Code: 134
[11:07:59][Step 6/6] [ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[11:07:59][Step 6/6] [ERROR] Command was /bin/sh -c cd /opt/*******/buildAgent/work/3c34aba90580ae72/ep-elm-web && /opt/jdk-11.0.2/bin/java -Xmx1024m -XX:MaxPermSize=256m -javaagent:/opt/*******/buildAgent/tools/jacoco.0.7.5/jacocoagent.jar=append=true,destfile=/opt/*******/buildAgent/temp/buildTmp/JACOCO158546265956865605coverage/jacoco.exec org.apache.maven.surefire.booter.ForkedBooter /opt/*******/buildAgent/work/3c34aba90580ae72/ep-elm-web/target/surefire 2019-02-20T11-07-58_396-jvmRun1 surefire6001620761776512056tmp surefire_02647190773594316116tmp
[11:07:59][Step 6/6] [ERROR] Error occurred in starting fork, check output in log
[11:07:59][Step 6/6] [ERROR] Process Exit Code: 134
[11:07:59][Step 6/6] [ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:669) 

我继续检查日志文件中的输出,这就是我得到的:

Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'FATAL ERROR i
n native method: processing of -javaagent failed'.
java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third chara
cter in command 'FATAL ERROR in native method: processing of -javaagent failed'.
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<
init>(ForkClient.java:507)
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkC
lient.java:210)
        at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkC
lient.java:177)
        at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumpe
r.run(ThreadedStreamConsumer.java:88)
        at java.lang.Thread.run(Thread.java:745

)

有没有人遇到过这个问题并且有办法解决它吗?


None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

运行 Maven Surefire 测试插件 Java 11 时出错 的相关文章

随机推荐