File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
### 80.3 自定义依赖版本
2
2
3
- 如果你使用Maven进行一个直接或间接继承` spring-boot-dependencies ` (比如` spring-boot-starter-parent ` )的构建,并想覆盖一个特定的第三方依赖,那你可以添加合适的` <properties> ` 元素。浏览[ spring-boot-dependencies] ( http://github.com/spring-projects/spring-boot/tree/master/spring-boot-dependencies/pom.xml ) POM可以获取一个全面的属性列表。例如,想要选择一个不同的slf4j版本 ,你可以添加以下内容:
3
+ 如果你使用Maven进行一个直接或间接继承` spring-boot-dependencies ` (比如` spring-boot-starter-parent ` )的构建,并想覆盖一个特定的第三方依赖,那你可以添加合适的` <properties> ` 元素。浏览[ spring-boot-dependencies] ( http://github.com/spring-projects/spring-boot/tree/master/spring-boot-dependencies/pom.xml ) POM可以获取一个全面的属性列表。例如,想要选择一个不同的 ` slf4j ` 版本 ,你可以添加以下内容:
4
4
``` xml
5
5
<properties >
6
6
<slf4j .version>1.7.5<slf4j .version>
7
7
</properties >
8
8
```
9
- ** 注** : 这只在你的Maven项目继承(直接或间接)自` spring-boot-dependencies ` 才有用。如果你使用` <scope>import</scope> ` ,将` spring-boot-dependencies ` 添加到自己的` dependencyManagement ` 片段,那你必须自己重新定义artifact而不是覆盖属性。
9
+ ** 注** 这只在你的Maven项目继承(直接或间接)自` spring-boot-dependencies ` 才有用。如果你使用` <scope>import</scope> ` ,将` spring-boot-dependencies ` 添加到自己的` dependencyManagement ` 片段,那你必须自己重新定义artifact而不是覆盖属性。
10
10
11
- ** 注** :每个Spring Boot发布都是基于一些特定的第三方依赖集进行设计和测试的,覆盖版本可能导致兼容性问题。
11
+ ** 注** 每个Spring Boot发布都是基于一些特定的第三方依赖集进行设计和测试的,覆盖版本可能导致兼容性问题。
12
+
13
+ Gradle中为了覆盖依赖版本,你需要指定如下所示的version:
14
+ ``` gradle
15
+ ext['slf4j.version'] = '1.7.5'
16
+ ```
17
+ 更多详情查看[ Gradle Dependency Management插件文档] ( https://github.com/spring-gradle-plugins/dependency-management-plugin ) 。
You can’t perform that action at this time.
0 commit comments