为什么默认排除 junit-vintage-engine ?

为什么默认排除 junit-vintage-engine ?
记录用!!!
使用 Spring Initializr 创建 Spring Boot 项目时,默认是包含 spring-boot-starter-test 包的。

如果选择 spring-boot-starter-parent 2.3.10 版时,会发现其依赖的写法如下:

org.springframework.boot spring-boot-starter-test test org.junit.vintage junit-vintage-engine 之所以自动排除 junit-vintage-engine 是因为 spring-boot-starter-test 的 2.2.x 和 2.3.x 版本中还包含另外一个测试引擎 junit-jupiter-engine 。

junit-vintage-engine:用于 Junit-4 测试
junit-jupiter-engine:用于 Junit-5 测试

JUnit Jupiter is the combination of the new programming model and extension model for writing tests and extensions in JUnit 5. The Jupiter sub-project provides a TestEngine for running Jupiter based tests on the platform.

JUnit Vintage provides a TestEngine for running JUnit 3 and JUnit 4 based tests on the platform.

如果选择 spring-boot-starter-parent 2.4.5 版,则可以发现默认已经不包含这段 exclusions 配置了。

org.springframework.boot spring-boot-starter-test test 原因在于 spring-boot-starter-test 2.4.x 版本中,已经不再包含 junit-vintage-engine 这个依赖项了。

版权声明:本文为博主「佳佳」的原创文章,遵循 CC 4.0 BY-NC-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://www.liujiajia.me/2021/5/14/why-exclude-junit-vintage-engine-by-default

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值