如何仅为发布版本显示依赖项更新

Ale*_*x R 12 maven

当我运行时versions:display-dependency-updates,它将显示我的依赖项的所有最新beta /里程碑版本.我更喜欢使用"发布"包.

versions:use-latest-releases谈论"替换"最新版本.但是,我更喜欢手动更新版本.

我可以运行版本插件给我一个关于我的依赖项和插件的最新"发布"版本的报告吗?

我指的是mvnrepository.org上列出的软件包的"类型"

ruh*_*ong 8

两步

添加rulesUri到插件配置

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>versions-maven-plugin</artifactId>
    <version>2.3</version>
    <configuration>
        <rulesUri>file:///${project.basedir}/rules.xml</rulesUri>
    </configuration>
    <executions>
        <execution>
        <phase>compile</phase>
        <goals>
            <goal>display-dependency-updates</goal>
            <goal>display-plugin-updates</goal>
        </goals>
        </execution>
    </executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)

rules.xml文件添加到您的项目根目录。

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
    <ignoreVersions>
        <!-- Ignore Alpha's, Beta's, release candidates and milestones -->
        <ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*a(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion>
        <ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
    </ignoreVersions>
    <rules>
    </rules>
</ruleset>
Run Code Online (Sandbox Code Playgroud)

正则表达式过滤掉不稳定的版本。您还可以将规则指定为特定的依赖项,请参见:

http://blog.xebia.com/keeping-dependencies-up-to-date-in-maven/

https://gist.github.com/seahrh/b13f4f3d618ad7c817038e0bc124ef29

版本规则也将保留在该插件的将来版本中。