测试失败时如何运行Maven目标? [英] How to run a maven goal when there is tests failures?

查看:93
本文介绍了测试失败时如何运行Maven目标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在测试失败时是否有执行目标的方法?

I would like to know if there is a way to execute a goal when there is test failures?

既然maven在遇到测试失败后会停止执行(快速失败模式),那么当测试失败时,是否有其他选择可以启动目标?

Since maven stops its execution (fail fast mode) after encountering a test failure, is there any options to launch a goal when there is test failures?

致谢.

推荐答案

我一直在寻找一种实现此目的的方法,但效果不佳.

I've been searching for a way to do this as well, with not much success.

但是,以下问题可能会提供一些一般性提示:

However, there is the following question which might provide some general hints:

Maven报告插件不会如果发生单元测试失败,则执行

这个想法是,您将首先运行mvn install(或其他),然后运行:

The idea is that you would run mvn install (or whatever) first, and then run:

mvn -Dmaven.test.skip=true your-plugin:your-goal

mvn -Dmaven.test.skip=true your-plugin:your-goal

这将使您无需运行测试即可再次运行构建,从而保留结果供您阅读.当然,这仅在您的插件正在解析测试结果时才有用...

This will let you run the build again without running tests, preserving the results for your perusal. Of course, this is only useful if your plugin is parsing the test results...

这篇关于测试失败时如何运行Maven目标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆