<useSystemClassLoader>false</useSystemClassLoader>

jenkins上运行接口测试用例报错:

Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test (default-test) on project apitest: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19:test failed: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/jenkins/workspace/dht-ceshi112 && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Dfile.encoding=UTF-8 -jar /home/jenkins/workspace/dht-ceshi112/target/surefire/surefirebooter2365510698734909951.jar /home/jenkins/workspace/dht-ceshi112/target/surefire/surefire2899246126287720087tmp /home/jenkins/workspace/dht-ceshi112/target/surefire/surefire_07248019886580183342tmp
[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/PluginExecutionException

修改方法:pom.xml中增加<useSystemClassLoader>false</useSystemClassLoader>解决,设置maven使用独立的类加载器
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<forkMode>once</forkMode>
<argLine>-Dfile.encoding=UTF-8</argLine>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFiles}</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>

posted on 2018-11-12 10:07  张&娟  阅读(1363)  评论(0编辑  收藏  举报

导航