如何使用Versions Maven Plugin更新依赖兄弟模块的版本

mkk*_*kko 3 maven-2

我有一个更新依赖兄弟项目的依赖版本的问题.

我的简化项目设置如下.

root
|--parent
|--tool-core
|--tool
|--functional-tests
Run Code Online (Sandbox Code Playgroud)

父项目包含所有全局属性和依赖关系管理.功能测试取决于工具,工具取决于工具核心.pom.xml仅根聚合(指定是否包括功能测试),而父项目是所有项目的父项.我不知道这是否微不足道,但父级不包含在聚合中,因为它已经是每个子项目的父级.

现在,我的问题是如果我改变工具的版本versions:set.工具版本已更改,但对工具的任何依赖性均未更改.我该怎么做?我已经尝试了或多或少随机的其他目标,我确实尝试阅读手册.

我已经尝试使用该<dependencyManagement>部分并使用父级版本的属性,但这些不会更新到新版本.

任何帮助都非常感谢.

加成

我得到一条消息"Ignoring reactor dependency:com.tool:tool:jar:null:1.2.3".这是我尝试的时候versions:use-latest-releases.但是,versions:display-dependency-updates确实表明存在"本地依赖"的更新(功能测试取决于工具).

更新

似乎Maven会从存储库中查找新版本,包括本地的版本,现在我认为它很明显.但是,这意味着必须在更新依赖项之前构建并安装该工具到本地存储库.

我只是想知道这是否是将集成测试作为自己的项目的正确方法.我希望有一种方法可以立即更新版本.

更新

基本上我有以下设置.在该版本依赖functional-teststool是通过定义的parent项目.我省略了tool-core因为它可以作为一部分处理tool.

根:

<groupId>com.somecompany</groupId>
<artifactId>x-reactor</artifactId>
<packaging>pom</packaging>
<version>1.0</version>

<profiles>
    <profile>
        <id>cli</id>
        <modules>
            <module>tool</module>
        </modules>
    </profile>
    <profile>
        <id>deploy</id>
        <modules>
            <module>tool</module>
            <module>functional-tests</module>
        </modules>
    </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)

父:

<groupId>com.somecompany</groupId>
<artifactId>x-parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.somecompany</groupId>
            <artifactId>tool</artifactId>
            <version>3.2.3</version>
        </dependency>
    </dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

工具:

<parent>
    <groupId>com.somecompany</groupId>
    <artifactId>x-parent</artifactId>
    <version>1.0</version>
    <relativePath>../parent/pom.xml</relativePath>
</parent>

<groupId>com.somecompany</groupId>
<artifactId>tool</artifactId>
<packaging>jar</packaging>
<version>3.2.3</version>
Run Code Online (Sandbox Code Playgroud)

功能性的测试:

<parent>
    <groupId>com.somecompany</groupId>
    <artifactId>x-parent</artifactId>
    <version>1.0</version>
    <relativePath>../parent/pom.xml</relativePath>
</parent>

<groupId>functional-tests</groupId>
<artifactId>functional-tests</artifactId>
<version>0.1</version>
<packaging>pom</packaging>

<dependencies>
    <dependency>
        <groupId>com.somecompany</groupId>
        <artifactId>tool</artifactId>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

Han*_*ler 6

我目前遇到了与"使用 - 发布"目标相同的问题,并且很高兴版本插件(刚才?)通过参数" excludeReactor = false " 支持这种情况!:-)