gpt4 book ai didi

java - 使用属性值设置 Maven 父版本?

转载 作者:行者123 更新时间:2023-11-30 06:19:15 25 4
gpt4 key购买 nike

您好,我正在尝试将 Maven 中的父版本设置为属性上定义的版本,但它不起作用

这是我写的

<parent>
<groupId>com.me.android</groupId>
<artifactId>me-android</artifactId>
<version>${tools.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
<tools.version>1.0.0-SNAPSHOT</tools.version>
<properties>

它不起作用,我必须手动输入版本值而不是使用属性值。

下方错误

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.me.android:tools-android-hello:${tools.version} (/Users/me/Work/tools-android/ToolsServer/pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Could not transfer artifact com.me.android:tools-android:pom:${tools.version} from/to releases (http://artifactory/artifactory/releases): Illegal character in path at index 89: http://artifactory/artifactory/releases/com/me/android/tools-android/${tools.version}/tools-android-${tools.version}.pom and 'parent.relativePath' points at wrong local POM @ line 11, column 13 -> [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 does not allow variables to be specified in any of the elements within the parent element. When installing or deploying a project Maven will copy the pom.xml for the project into the local or remote repository. No changes are made to the file.

有关详细说明和可能的解决方法,请参阅此 JIRA 问题:

http://docs.codehaus.org/display/MAVEN/Automatic+Parent+Versioning

虽然这个错误是在 2008 年记录的,但不幸的是它仍然是一个当前问题。查看列出的相关问题,尤其是:

http://jira.codehaus.org/browse/MNG-624

这是最近更新的。似乎近期没有补救措施,但您可以尝试解决方法。

关于java - 使用属性值设置 Maven 父版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23493020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com