【发布时间】:2010-08-31 06:03:06
【问题描述】:
我在更新依赖同级项目的依赖版本时遇到问题。
我的简化项目设置如下。
root
|--parent
|--tool-core
|--tool
|--functional-tests
父项目拥有所有的全局属性和依赖管理。功能测试依赖于工具,而工具依赖于工具核心。根pom.xml 仅聚合(指定是否包含功能测试),并且父项目是所有项目的父项目。我不知道这是否是微不足道的,但父级不包含在聚合中,因为它已经是每个子项目的父级。
现在,我的问题是如果我用versions:set 更改工具的版本。工具版本已更改,但对工具的任何依赖性均未更改。我该怎么做?我已经或多或少地随机尝试过其他目标,并且我确实尝试过阅读手册。
我已经尝试使用 <dependencyManagement> 部分并使用父版本中的属性,但这些没有更新到新版本。
非常感谢任何帮助。
加法
我最多收到一条消息“忽略反应器依赖项:com.tool:tool:jar:null:1.2.3”。这是我尝试versions:use-latest-releases 的时候。但是,versions:display-dependency-updates 确实显示了“本地依赖项”的更新(功能测试取决于工具)。
更新
似乎 Maven 会从存储库中查找新版本,包括本地版本,现在我想到它似乎很明显。但是,这意味着必须在更新依赖项之前构建该工具并将其安装到本地存储库。
我只是想知道这是否是将集成测试作为他们自己的项目的正确方法。我希望有一种方法可以立即更新版本。
更新
基本上我有以下设置。 tool 对functional-tests 的版本依赖由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>
父母:
<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>
工具:
<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>
功能测试:
<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>
【问题讨论】:
-
你能给你不同模块的pom的sn-ps吗...(只有父部分和模块部分)。
标签: maven-2