问题描述
当我运行versions:display-dependency-updates
时,它将显示我的依赖项的所有最新beta/里程碑版本.我更喜欢使用发布"软件包.
When I'm running versions:display-dependency-updates
, it will show all the newest beta / milestone versions of my dependencies. I prefer using "release" packages.
versions:use-latest-releases
讨论最新版本的替换".但是,我更喜欢手动更新版本.
versions:use-latest-releases
talks about "replacing" with the latest release version. However, I prefer updating the versions manually.
我可以运行版本插件向我报告依赖项和插件的最新发布"版本吗?
Can I run the versions plugin to give me a report on the latest "release" versions of my dependencies and plugins?
我指的是 mvnrepository.org
推荐答案
两个步骤
将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>
将rules.xml
文件添加到您的项目根目录中.
Add the rules.xml
file to your project root directory.
<?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>
正则表达式过滤掉不稳定的版本.您还可以针对特定依赖项定位规则,请参阅:
The regex filters out the unstable releases. You can also target rules for specific dependencies, see:
http://blog.xebia.com/keeping -依赖最新的Maven/
https://gist.github.com/seahrh/b13f4f3d618ad7c817038e0bc124ef29
版本规则还将保留以供将来发行的插件.
这篇关于如何仅显示发行版的依赖项更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!