IntelliJ Idea - 没有为 junit:junit:5.0-SNAPSHOT 下载文件

IntelliJ Idea - No files were downloaded for junit:junit:5.0-SNAPSHOT

很少接触 Maven 和其他外部库。 Junit 一周前运行良好,可能受到更新的影响?不确定,尝试安装其他版本时会发生同样的错误。

10:08 p.m。存储库库同步:没有为 junit:junit:5.0-SNAPSHOT

下载文件

同样,它一周前工作得很好,这是测试 - https://github.com/Ry4nW/CS-11-VLN/blob/main/CS%2011%20VLN/IntegerSetTest/TestCases/IntegerSetTests.java

您配置的依赖项有误。根据您的测试,您使用的是 JUnit 4。您的依赖项应该是

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit<artifactId>
    <version>4.13.2</version>
    <scope>test</scope>
</dependency>

junit:junit 没有版本 5.x。 JUnit 5 使用不同的组和工件 ID。例如

<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-api</artifactId>
    <version>5.7.1</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.junit.jupiter</groupId>
    <artifactId>junit-jupiter-engine</artifactId>
    <version>5.7.1</version>
    <scope>test</scope>
</dependency>