spring maven项目解决依赖jar包版本冲突方案
引入:http://blog.csdn.net/sanzhongguren/article/details/71191290
在spring reference中提到一个解决spring jar包之间版本冲突的解决方案,原文如下
It is possible to accidentally mix different versions of Spring JARs when using Maven. For example, you may find that a third-party library, or another Spring project, pulls in a transitive dependency to an older release. If you forget to explicitly declare a direct dependency yourself, all sorts of unexpected issues can arise.
To overcome such problems Maven supports the concept of a "bill of materials" (BOM) dependency. You can import the spring-framework-bom in yourdependencyManagement section to ensure that all spring dependencies (both direct and transitive) are at the same version.
在配置spring项目依赖时可以通过引入spring-framework-bom避免项目中的spring jar包及关联依赖的三方jar包之间的版本冲突,引入方式:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>4.1.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
引入后的另一个好处就是在pom文件中引入spring相关依赖时不用再声明<version>属性,以后直接像下边这样声明就可以了:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependencies>
PS: Spring官方reference网址 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/
还有就是最近找到一个翻译reference的网址,虽然没有翻译完整有兴趣的也可以看看 http://spring.cndocs.tk/
spring maven项目解决依赖jar包版本冲突方案的更多相关文章
- eclipse导入maven项目后依赖jar包更新问题->update project按钮
eclipse导入maven项目后依赖jar包更新问题 1.eclipse有专门的导入maven项目按钮,file-import-maven project,eclipse会自动查找指定路径下的pom ...
- maven项目导入依赖jar包并打包为可运行的jar包
1.在pom.xml文件中添加插件 <build> <finalName>LeadServer</finalName> <!-- jar包名前缀,如果没有指定 ...
- maven项目搜索依赖jar包顺序
local_repo > settings_profile_repo > pom_profile_repo > pom_repositories > setti ...
- spring data redis的使用jar包版本冲突问题
spring data redis 与spring 版本之间会有不兼容,要求spring 最低版本为4.2.6,这里推荐的一个版本 spring 4.3.2 spring data redis 1. ...
- Intellij IDEA 中如何查看maven项目中所有jar包的依赖关系图(转载)
Intellij IDEA 中如何查看maven项目中所有jar包的依赖关系图 2017年04月05日 10:53:13 李学凯 阅读数:104997更多 所属专栏: Intellij Idea ...
- Intellij IDEA 中如何查看maven项目中所有jar包的依赖关系图
Maven 组件界面介绍 如上图标注 1 所示,为常用的 Maven 工具栏,其中最常用的有: 第一个按钮:Reimport All Maven Projects 表示根据 pom.xml 重新载入项 ...
- eclipse maven 项目导出为 jar 包
一个 maven 项目有很多依赖,所以最后打出的 jar 一般会很多,且比较大,打成 jar 包的步骤 (注意pom.xml文件中打包类型不能是war包): 1. 把 pom.xml 中依赖的库打成 ...
- maven无法下载依赖jar包—几种仓库的区别
一.问题背景 最近这两天,感觉自己智商急剧退化,到了自己都捉急的地步,呃,有必要记录下来,以后智商被人甩几条街的时候,看看这篇文字,找找灵感也是好的! 这个项目呢,是用IDEA开发的,我一切都弄好了, ...
- maven项目引用外部jar包的方法
问题描述: 有一个java maven web项目,需要引入一个第三方包gdal.jar,但是这个包是自己打包的,在maven中央库里面找不到该包,因此我采用传统的方式,将这个包拷贝到:项目名称\sr ...
随机推荐
- Codeforces 28C Bath Queue 【计数类DP】*
Codeforces 28C Bath Queue LINK 简要题意:有 n 个人等概率随机进入 m 个房间,一个房间可以有多个人,第 i 个房间有 ai 个水龙头,在一个房间的人要去排队装水,他们 ...
- 关于Mybatis将查询结果中添加常量列并返回
引言 在使用mybatis的时候,查询一个集合返回给前台页面,在有的时候,我们会添加一个常量字段到对象或者集合中,来标识这个对象属于的类型等等情况,当前台进行再次请求的时候携带此变量进行请求. 但是: ...
- iOS 信号量解决-网络异步请求的数据同步返回问题
有那么一个场景如下 +PayWithBlock:(NSString*(^)(NSString *message)) block; 如果 block 返回是同步的那是没有问题的,但是如果block 内容 ...
- LeetCode 675. Cut Off Trees for Golf Event
原题链接在这里:https://leetcode.com/problems/cut-off-trees-for-golf-event/description/ 题目: You are asked to ...
- Tencent Server Web 安装试用
Tencent Server Web 安装试用 私有环境搭建,使用docker-compose 进行memcache 安装 参考github 代码 https://github.com/rongfen ...
- wekan 工具配置
1. 安装 使用docker-compose 安装,主要是方便简单,后期维护比较简单 2. 配置 docker-compose.yaml 文件 version: '2' ser ...
- 笔记:NPM 无限需要依赖问题解决
笔记:NPM 无限需要依赖问题解决 起因 因为想学一下 VUE,开始跟着教程一步一步输出命令,开始也没有什么问题,一切都很顺利. 突然不知道是哪一步出了问题,一直让我安装依赖,没完没了,开始并不觉得有 ...
- 启动Oracle数据库时报错ORA-00119 & ORA-00132
今天启动Oracle数据库时报错ORA-00119 & ORA-00132,找到解决方法做个记录,方便日后查看. 若是ORACLE不提示错误的话,可以自己查看ORACLE的日志文件. Orac ...
- MFC消息循环
MFC消息循环 MFC应用程序中处理消息的顺序 1.AfxWndProc() 该函数负责接收消息,找到消息所属的CWnd对象,然后调用AfxCallWndProc. 2.AfxCallWndProc ...
- Java并发-Runnable、Callable、Future、Future Task
Runnable: Runnable的代码非常简单,他是一个接口,且接口中只有一个方法,run(),创建一个类实现他,把一些费时操作写在其中,然后使用某个线程去执行该Runnable实现类即可实现多线 ...