maven打包工程出现错误 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test

今天用maven在命令行打包项目的时候出现错误:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project xxx: There are test failures.

但是项目用maven编译没问题,之前测试也都过了。从上面描述可以确定是单元测试部分有问题,然后仔细研究了错误内容,发现是因为我定义了一个测试基类,里面没有任何测试方法,抛出了java.lang.Exception: No runnable methods。

解决办法:增加一个@Ignore,表示打包的时候忽略这个测试类,就能成功了。


转载:迷茫的叶

猜你喜欢

转载自www.cnblogs.com/ZeGod/p/10286843.html