Using maven to create junit xml reports of jar

痞子三分冷 提交于 2020-02-02 14:30:33

问题


I have inherited a codebase whereby we have a maven project of component tests that use junit as the framework that runs the tests.

Everything runs OK, but the problem is that these tests must be compiled into a jar-with-dependencies so that they can be run on a standalone computer with very limited outwards connectivity (e.g does not have access to maven central).

I have managed to create a runnable jar with dependencies which I can run using junit.jar and the command line like so:

java -cp jar-with-dependencies.jar:junit.jar junit.jar org.junit.runner.JUnitCore com.testsuite.AllTests

This works but the problem is that I also need to output the junit results into XML, like maven's surefire plugin does.

My question is, can I run this jar-with-dependencies using maven such that it creates the junit xml reports?

I can successfully run the tests using exec-maven-plugin which essentially runs the previously stated command

来源:https://stackoverflow.com/questions/47789899/using-maven-to-create-junit-xml-reports-of-jar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!