【发布时间】:2019-04-18 13:54:13
【问题描述】:
我刚刚升级了我的项目以使用 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/
【问题讨论】:
-
能否将 POM 文件添加到问题中?
-
你在使用maven/gradle/...吗?
-
Maven,我只更改了 spring-boot 版本。|你想看到“有效的 POM”还是只是为了一个项目? (这会很困难,因为版本由 spring 和我的父 POM 管理)
-
如果你正在升级你的 spring boot jar 版本,那么我认为你应该考虑在需要保持向后兼容性的地方升级依赖项的版本。从长远来看,这将有所帮助。 mvnrepository.com/artifact/org.springframework.boot/spring-boot/…
-
问题是,例如
@DataJpaTest或@SpringBootTest注释用@ExtendWith注释,这是JUnit 5 的一部分,所以看起来你必须在类路径中使用JUnit 5 API,即使你没有使用它。
标签: java spring-boot spring-boot-test