我正在使用旧版 Spring 应用程序并想迁移到 Spring Boot。我的意图是使用 spring-boot-starter-data-jpa
。为此,我在 pom.xml
(管理所有 spring-boot-dependencies
)中添加了以下部分:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>
但这搞砸了我需要暂时保留的某些依赖项。我目前正在使用 Selenium 依赖项(版本 2.53.0
;从另一个项目传递添加)但是 spring-boot 正在获取 3.9.1
的依赖项。
我想排除 3.9.1
依赖项,但 exclusion
过滤器没有按预期工作。
总结一下,我想使用 spring-boot-starter-parent
和 spring-boot-starter-data-jpa
但不想使用托管的 selenium -java
来自 spring-boot-dependencies
。
感谢这方面的任何帮助。
最佳答案
与其乱搞 <excludes>
然后尝试找出您需要再次包含的内容(在弄清楚您排除的内容之后)。只需按照说明覆盖版本 here in the Spring Boot Reference Guide .
假设您使用的是 spring-boot-starter-parent
作为 parent ,您只需添加 <selenium.version>
给你的<properties>
部分来指定你想要的版本。
<properties>
<selenium.version>2.53.0</selenium.version>
</properties>
这将使 Spring Boot 使用您想要的版本。
关于java - 如何从 spring-boot-starter-parent 中排除特定的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51239227/