在发布之前,我需要更改项目的所有快照依赖性.我正在尝试从命令行mvn版本:use-releases版本:use-releases,但是它对我不起作用.我正在使用Nexus存储库发布版本,发布版本已正确部署并具有公共访问权限
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.efx.util</groupId>
<artifactId>efx-util</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
当我执行:mvn版本:使用发布时,它什么也不做.
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-api 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-api ---
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-impl 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-impl ---
[INFO] Ignoring reactor dependency: com.efx.clientesocket:efx-clientesocket-api:jar:0.0.1-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building efx-clientesocket-conf 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:use-releases (default-cli) @ efx-clientesocket-conf ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] efx-clientesocket .................................. SUCCESS [ 1.539 s]
[INFO] efx-clientesocket-api .............................. SUCCESS [ 0.031 s]
[INFO] efx-clientesocket-impl ............................. SUCCESS [ 0.016 s]
[INFO] efx-clientesocket-conf ............................. SUCCESS [ 0.015 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
但是版本:display-dependency-updates检测到相应的版本
------------------------------------------------------------------------
[INFO] Building efx-clientesocket-conf 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- versions-maven-plugin:2.2:display-dependency-updates (default-cli) @ efx-clientesocket-conf ---
[INFO] artifact junit:junit: checking for updates from nexus
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO] com.efx.util:efx-util ................ 0.0.1-SNAPSHOT -> 1.0.0-RELEASE
[INFO] junit:junit ............................................. 4.11 -> 4.12
[INFO]
[INFO] ------------------------------------------------------------------------
我也在尝试使用version:use-last-releases作为替代,一切正常.在这种情况下,我使用-Dincludes =来避免更新无快照版本.但是,我想使用versions:use-releases来确保仅更新所有快照版本并覆盖属性中的版本.
我正在使用的Maven版本是3.3.1,插件版本是2.2
有人知道为什么不起作用吗?
解决方法:
1-版本:use-releases在pom中搜索所有已发布的-SNAPSHOT版本,并将其替换为相应的发布版本.
com.efx.util:efx-util ................ 0.0.1-SNAPSHOT -> 1.0.0-RELEASE
这意味着efx-util-0.0.1-SNAPSHOT应该具有对应的Release efx-util-0.0.1-RELEASE或efx-util-0.0.1(0.0.1的发行版本),否则它将无法正常工作. 1.0.0-RELEASE不是相应的发行版
2-版本:use-latest-releases在pom中搜索所有非SNAPSHOT版本,这些版本都是较新的版本,并将其替换为最新版本.
在这种情况下,它不限于(0.0.1-SNAPSHOT)的相应发行版.因此,发行版可能具有不同的版本号(1.0.0-RELEASE).
希望这可以帮助.