我刚刚将我的项目升级为使用 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
我可以添加依赖项 org.junit.jupiter/junit-jupiter-api 来解决警告,但我觉得这是一个“hack”。
我不想看到该警告(尤其是我的项目将警告视为错误)并且我不想用不必要的依赖项污染我的项目。
我正在使用 Maven,但我可以看到有人对 Gradle 有同样的问题 https://www.reddit.com/r/java/comments/9sogxf/spring_boot_210_released_now_with_java_11_support/
最佳答案
如果您将 org.junit.jupiter:junit-jupiter-api
依赖项添加到项目中,警告就会消失。
它不应该受到伤害,因为它只是 API jar 并且仅在测试范围内。
关于java - Spring Boot 2.1.0 有 JUnit5 依赖,但如何摆脱它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53319852/