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

时间:2019-02-20 12:00:40

标签: maven teamcity jacoco maven-surefire-plugin java-11

我正在使用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

)

有人遇到过此问题,有没有解决的方法?

0 个答案:

没有答案