idea测试时报错

本文详细介绍了在使用JUnit进行测试时遇到的依赖问题及其解决方法。作者分享了因网络限速导致依赖下载失败的经历,并提供了需要添加的四个关键依赖项,帮助读者避免类似错误。

Failed to resolve org.junit.platform:junit-platform-launcher:1.5.2 测试报错

报错
找了很长时间,这是因为缺少依赖,我添加一个依赖也这样,添加两个也是这样,气炸
再找找原因,是因为我用的是手机的热点流量,手机还限速了,所以导致下载不下来

解决方法:

要添加4个依赖:

<!-- Junit依赖 -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- this is needed or IntelliJ gives junit.jar or junit-platform-launcher:1.3.2 not found errors -->
            <groupId>org.junit.platform</groupId>
            <artifactId>junit-platform-launcher</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>

手动添加进去下载就好了

最后:帮到你点个赞呗!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值