maven检查是否有新依赖/插件的方法

maven是现在最流行的项目管理工具,在企业中使用的非常广泛。

在一个maven管理的项目中,一般会配置很多依赖、插件,如何检查这些依赖是否有最新的版本?

除了去这些框架的官方网站上看,maven也自带了检查最新版本的方法

就是使用version插件versions-maven-plugin


versions:display-dependency-updates scans a project's dependencies and produces a report of those dependencies which have newer versions available.
versions:display-plugin-updates scans a project's plugins and produces a report of those plugins which have newer versions available.
versions:display-property-updates scans a projectand produces a report of those properties which are used to control artifact versions and which properies have newer versions available.


比如说,有配置如下依赖:

<dependencies>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-core</artifactId>
		<version>4.3.4.RELEASE</version>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-beans</artifactId>
		<version>4.3.4.RELEASE</version>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-context</artifactId>
		<version>4.3.4.RELEASE</version>
	</dependency>
	<dependency>
		<groupId>org.springframework</groupId>
		<artifactId>spring-web</artifactId>
		<version>4.3.4.RELEASE</version>
	</dependency>
</dependencies>

这里配置的是4.3.4,当前最新的版本是4.3.6

执行mvn versions:display-dependency-updates 查看是否有新的依赖版本:



报告里面已经指出有新的版本依赖,最新的依赖是4.3.6

如果项目里面已经是最新的依赖,则结果如下:



提示没有新的版本。


检查插件的方法类似(mvn versions:display-plugin-updates),这里就不重复演示了。


  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值