Using Spring Boot without the parent POM
Using Spring Boot without the parent POM;
问题
spring boot项目一般情况下的parent如下:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version>
</parent>
但是如果这个项目是其他项目的子项目呢???,意味着pom文件里要多个parent,但是一个孩子多个亲爸的事情怎么允许在代码的世界呢;(pom中只能一个parent);
解决
关于spring-boot,人家官网说了,不一定非要继承spring-boot的parent pom的,人家已经考虑到你可能已经继承了其他parent的情况,并给出了dependency management的方案。
Not everyone likes inheriting from the spring-boot-starter-parent POM. You may have your own corporate standard parent that you need to use, or you may just prefer to explicitly declare all your Maven configuration.
If you don’t want to use the spring-boot-starter-parent, you can still keep the benefit of the dependency management (but not the plugin management) by using a scope=import dependency:
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
That setup does not allow you to override individual dependencies using a property as explained above. To achieve the same result, you’d need to add an entry in the dependencyManagement of your project before the spring-boot-dependencies entry. For instance, to upgrade to another Spring Data release train you’d add the following to your pom.xml.
<dependencyManagement>
<dependencies>
<!-- Override Spring Data release train provided by Spring Boot -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Fowler-SR2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.4.0.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
In the example above, we specify a BOM but any dependency type can be overridden that way.
完美解决~~~ ,想起上个单位的大神,总喜欢看官网。虽然慢,但是很快。一步一步,是魔鬼的步伐
Using Spring Boot without the parent POM的更多相关文章
- Spring boot 官网学习笔记 - Using Spring Boot without the Parent POM,但是还要使用Parent POM提供的便利
If you do not want to use the spring-boot-starter-parent, you can still keep the benefit of the depe ...
- Spring Boot系列(一) Spring Boot介绍和基础POM文件
Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置.通过 ...
- Spring Boot 推荐的基础 POM 文件
名称 说明 spring-boot-starter 核心 POM,包含自动配置支持.日志库和对 YAML 配置文件的支持. spring-boot-starter-amqp 通过 spring-rab ...
- Spring boot 自定义一个starter pom
用过springboot的自动配置会觉得非常方便,我们完全可以自己写一个starter pom,这样不仅可以有自动配置功能,而且具有更通用的的耦合度低的配置, 新建一个starter的maven项目, ...
- Spring Boot文档阅读
原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...
- Spring Boot 学习笔记
参考资料 http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/ Spring Boot简介 Spring Boot使 ...
- Spring Boot 针对 Java 开发人员的安装指南
Spring Boot 可以使用经典的开发工具或者使用安装的命令行工具.不管使用何种方式,你都需要确定你的 Java 版本为 Java SDK v1.8 或者更高的版本.在你开始安装之前,你需要确定你 ...
- Spring Boot Reference Guide
Spring Boot Reference Guide Authors Phillip Webb, Dave Syer, Josh Long, Stéphane Nicoll, Rob Winch, ...
- 《Spring Boot官方指南》(二)入门
如果您刚开始接触Spring Boot,或者简称’Spring’, 这个部分对您来说非常有用.这个部分提供了“是什么?”,“怎么做?”和 “为什么?”的解释.您除了会阅读一份附带Spring Boot ...
随机推荐
- bbs网站 models
bbs网站 models #!/usr/bin/env python #_*_coding:utf-8_*_ from django.db import models from django.cont ...
- DuiLib学习bug整理——某些png不能显示
今天下午遇到用ps导出的png显示不出来的情况.而从其他来源的png有的可以显示.到群里问了下也有人遇到过,但是都没想明白具体原因.后来经人指点说png保存时存在深度位不同.最后经过测试 8位深度.3 ...
- Quartz.NET
http://www.360doc.com/userhome.aspx?userid=11741424&cid=2#
- 7.$a = 'abcdef'; 请取出$a的值并打印出第一个字母
echo $a[0]; echo $a{0}; echo chr(ord($a));//先输出$a字符串里的第一个字符的ASCII值 再从指定的 ASCII 值返回字符.
- 左 or 右
背景: 掌握的知识:C++.MFC.设计模式.STL,熟悉windows网络编程,了解COM组件但是不精. 近期辞职找工作,发现windows下的C++开发职位很少.linux和移动端开发职位多,但是 ...
- python日志模块
许多应用程序中都会有日志模块,用于记录系统在运行过程中的一些关键信息,以便于对系 统的运行状况进行跟踪.在.NET平台中,有非常著名的第三方开源日志组件log4net,c++中,有人们熟悉的log4c ...
- 【C解毒】滥用变量
见:[C解毒]滥用变量
- spring.net
Spring.Net有两个很重要的感念就是IoC(控制反转)和DI(依赖注入). IoC.英文全称Inversion of Control.控制反转.DI.英文全称Dependency Injecti ...
- 运行nodejs的blog程序遇见问题
我是运行这个教程的代码.可以在网上找到相关视频和代码. 第一个问题,数据库中没有创建对应的表就开始运行程序.node app.js 这个错误问题大家可以去重现一下 第二个问题,我也没有看明白,但是我根 ...
- apache开启rewrite重写
命令开启 sudo a2enmod rewrite sudo /etc/init.d/apache2 restart 即可开启重写,不行的话再试下下面方法 ubuntu如何开启Rewrite模块 在终 ...