简体   繁体   中英

why auto dependency is error version?(java.lang.ClassNotFoundException: org.junit.jupiter.api.MethodOrdererContext)

I want to know why is not same to junit-jupiter-engine-5.4.0.pom defined.

when I explicit declaration junit-jupiter-api and junit-platform-engine version same as junit-jupiter-engine-5.4.0.pom,the problem be solved.

pom:

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

problem:

junit-jupiter-engine-5.4.0.pom dependency is

[INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.4.0:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.3.2:test
[INFO] |  |  +- org.junit.platform:junit-platform-commons:jar:1.3.2:test
[INFO] |  |  \- org.opentest4j:opentest4j:jar:1.1.1:test
[INFO] |  \- org.junit.jupiter:junit-jupiter-api:jar:5.3.2:test

but I run mvn dependency:tree ,result is this:

 [INFO] +- org.junit.jupiter:junit-jupiter-engine:jar:5.4.0:test [INFO] | +- org.apiguardian:apiguardian-api:jar:1.0.0:test [INFO] | +- org.junit.platform:junit-platform-engine:jar:1.3.2:test [INFO] | | +- org.junit.platform:junit-platform-commons:jar:1.3.2:test [INFO] | | \\- org.opentest4j:opentest4j:jar:1.1.1:test [INFO] | \\- org.junit.jupiter:junit-jupiter-api:jar:5.3.2:test
Build Tool: maven3.5.4

This is duplicate of Gradle 5 JUnit BOM and Spring Boot Incorrect Versions .

The solution is to add the following to your Maven POM.

<properties>
    <junit-jupiter.version>5.4.0</junit-jupiter.version>
</properties>

I have faced similar issue after updating spring boot dependencies to latest version and updating Juiper engine version to 5.6.1 has resolved my issue.

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM