【发布时间】:2019-05-20 13:38:43
【问题描述】:
我有一个使用 maven 管理的大型 java 项目。 我们使用 Maven 3 进行管理(特别是 3.6.0)。
在项目中,有一个带有runtime-v5.pom.xml 的子=项目。
在说pom,有一个版本属性
<properties>
<platform-v5.version>73.2.05</platform-v5.version>
</properties>
文件后面会用到
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.company.thing.platform</groupId>
<artifactId>platform-parent</artifactId>
<version>${platform-v5.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.company.release</groupId>
<artifactId>platform-v5</artifactId>
<version>${platform-v5.version}</version>
<type>resolved-pom</type>
</dependency>
</dependencies>
</dependencyManagement>
我的目标是让 maven 引入最新版本的平台,我不想每次都更新这个文件中的版本。我认为将特定版本更改为范围将使项目始终根据给定范围拉入最新版本。
当platform-v5.version 设置为特定的现有版本时,它构建得很好,但是当将版本设置为[73.2.05,) 之类的范围时,我收到诸如
[INFO] Scanning for projects...
[INFO] Downloading from all_global_universal: https://nexus.company/platform-parent/%5B73.2.05,).pom
[ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Could not find artifact com.company.thing.platform:platform-parent:pom:[73.2.05,) in all_global_universal (https://nexus.company/content/groups/all_global_universal) @ com.company:runtime-v5:[unknown-version], path/to/runtime-v5.pom.xml, line XX, column YY
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.company:runtime-v5:1.0.2 (path/to/runtime-v5.pom.xml) has 1 error
[ERROR] Non-resolvable import POM: Could not find artifact com.company.thing.platform:platform-parent:pom:[73.2.05,) in all_global_universal (https://nexus.company/content/groups/all_global_universal) @ com.company:runtime-v5:[unknown-version], path/to/runtime-v5.pom.xml, line XX, column YY -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
本质上,我想知道:为什么不能在maven依赖管理导入范围内提供版本范围?
【问题讨论】:
标签: java maven dependencies versioning