Spring Boot 2.1.0有JUnit5依赖,但如何摆脱它呢?

raz*_*zor 9 java spring-boot spring-boot-test

我刚刚升级了我的项目以使用Spring Boot 2.1.0(之前是2.0.x)并且我有编译警告:

[WARNING] Cannot find annotation method 'value()' in type 'org.junit.jupiter.api.extension.ExtendWith': class file for org.junit.jupiter.api.extension.ExtendWith not found
Run Code Online (Sandbox Code Playgroud)

我可以添加依赖org.junit.jupiter/junit-jupiter-api来解决警告,但我觉得这是'黑客'.

我不希望看到这个警告(特别是我的项目处理错误等警告),我不想用不必要的依赖项来污染我的项目.

我正在使用Maven,但我可以看到有人遇到与Gradle相同的问题 https://www.reddit.com/r/java/comments/9sogxf/spring_boot_210_released_now_with_java_11_support/

DAN*_*DAN 7

如果将org.junit.jupiter:junit-jupiter-api依赖项添加到项目中,警告将消失。它应该不会受到伤害,因为它只是API jar,而且仅在测试范围内。