如何检查pom.xml以获取更新的依赖项 [英] How to check pom.xml for updated dependencies

查看:237
本文介绍了如何检查pom.xml以获取更新的依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Maven和pom.xml相当陌生.有没有一种方法可以找出我哪些依赖项已过时,从而可以更新pom.xml中的版本号.

I am fairly new to Maven and pom.xml. Is there a way I can find out which of my dependencies that are outdated, so that I can update version numbers in my pom.xml.

例如,在其他语言中,Ruby具有命令gem list outdated,该命令为我提供了我可以更新的依赖项列表(rubygems)

In other languages, for instance, Ruby has the command gem list outdated that gives me a list of dependencies (rubygems) I can update

如果可以,我正在使用IntelliJ Idea.

I am using IntelliJ Idea if that can help.

推荐答案

您可以使用版本Maven插件.检查以下目标:

You can do this with the Versions Maven Plugin. Check the following goals:

以下是示例输出(摘自示例):

Here is a sample output (taken from the examples):

检查新的依赖更新

display-dependency-updates目标将检查项目中使用的所有依赖项,并显示这些依赖项的列表以及可用的较新版本.

Checking for new dependency updates

The display-dependency-updates goal will check all the dependencies used in your project and display a list of those dependencies with newer versions available.

以下是这种情况的一些示例:

Here are some examples of what this looks like:


svn checkout http://svn.codehaus.org/mojo/trunk/mojo/build-helper-maven-plugin build-helper-maven-plugin
cd build-helper-maven-plugin

运行

mvn versions:display-dependency-updates

哪个会产生以下输出:


[INFO] ------------------------------------------------------------------------
[INFO] Building Build Helper Maven Plugin
[INFO]    task-segment: [versions:display-dependency-updates]
[INFO] ------------------------------------------------------------------------
[INFO] [versions:display-dependency-updates]
[INFO]
[INFO] The following dependency updates are available:
[INFO]   org.apache.maven:maven-artifact ........................ 2.0 -> 2.0.9
[INFO]   org.apache.maven:maven-plugin-api ...................... 2.0 -> 2.0.9
[INFO]   org.apache.maven:maven-project ....................... 2.0.2 -> 2.0.9
[INFO]   org.codehaus.plexus:plexus-utils ....................... 1.1 -> 1.5.6
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 seconds
[INFO] Finished at: Fri Aug 15 10:46:03 IST 2008
[INFO] Final Memory: 10M/167M
[INFO] ------------------------------------------------------------------------

Pom安装

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>versions-maven-plugin</artifactId>
  <version>2.5</version>
</plugin>

这篇关于如何检查pom.xml以获取更新的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆