迁移后 IntelliJ 无法加载 JUnit5

IntelliJ fails to load JUnit5 after migration

我正在试验我认为纯粹是 Intellij 相关的问题(虽然我不知道如何修复它,也不知道它来自哪里)。我基本上按照 this tutorial 将测试从 JUnit 4 迁移到 5。

迁移后测试

迁移结束时,我现在在 pom.xml

中有以下依赖项
   <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>5.6.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.6.3</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>5.6.3</version>
      <scope>test</scope>
    </dependency>

和不同的测试类现在使用

import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Test;

问题

在 IntelliJ 中进行 运行 测试时,我不断得到 Cannot resolve symbol 'jupiter'。但是,我的 CI 管道 一切正常?!?!? (所以 IntelliJ 中可能有问题)。无论提议的修复操作是什么(resp. Add JUnit 5.4 to classpathAdd Maven dependencies),我总是得到相同的结果。那么下一步是什么?

环境

有趣的是,更改似乎没有反映在 cockpit.iml 上,因为它仍然包含

 <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />

没有提到 JUnit 5。这两个问题是否相关?

我试过的

某处不匹配,但我想不出哪里

完全相同的问题。我将 Junit 添加到 Maven pom 文件并修复了它。

https://mvnrepository.com/artifact/junit/junit/4.13.1

结果:pom.xml 中某处的 语法错误 阻止了 IntelliJ 正确下载新的依赖项(或者看起来是这样). refresh maven deps 按钮在点击后消失,但没有下载库。