I am experimenting what I think to be a purely Intellij related issue (though I don't know how to fix it nor where it comes from). I basically followed this tutorial to migrate tests from JUnit 4 to 5.
By the end of the migration, I now have the following dependencies in 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>
and the different Test Classes now uses
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.Test;
I keep getting Cannot resolve symbol 'jupiter'
while running tests in IntelliJ. However, everything is OK in my CI pipeline ???.. (so probably something wrong in IntelliJ). No matter the fix actions proposed (resp. Add JUnit 5.4 to classpath
and Add Maven dependencies
), I keep getting the same. So what's next?
Interestingly, changes do not seem to be reflected on cockpit.iml , for it still contains
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
and no mention of JUnit 5. Are both problems related?
org.junit.platform
: junit-platform-launcher
File | Invalidate Caches
File | Invalidate Caches
sources .idea
and cockpit.iml
to reimport everything.There is a mismatch somewhere but I can't figure where
exactly same issue. I added the Junit to Maven pom file and it fixed it.
Turns out: a syntax error somewhere in pom.xml
prevented IntelliJ from properly downloading new dependencies (or so it seems). The refresh maven deps button disappeared after clicking but libraries were not downloaded.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.