我使用 mvn 3.6.1 并且在以下情况下无法正确解析 ${revision} :
父存储库(单独的存储库):top/pom.xml:
<groupId>com.x</groupId>
<artifactId>top</artifactId>
<version>${revision}</version>
Run Code Online (Sandbox Code Playgroud)
mvn -Drevision=1.0.0 clean deploy # 在本地 .m2 中安装良好并部署到 nexus
派生子存储库(单独的存储库)
<groupId>com.x</groupId>
<artifactId>child</artifactId>
<version>${revision}</version>
<parent>
<groupId>com.x</groupId>
<artifactId>top</artifactId>
<version>${revision}</version> <!-- This is not resolving -->
<relativePath/>
</parent>
Run Code Online (Sandbox Code Playgroud)
mvn -Drevision=1.0.0 全新安装会引发错误不可解析的父 pom 错误:
Non-resolvable parent POM for com.x:child:${revision}: Could not transfer artifact com.x:top:pom:${revision} from/to nexus ($nexusUrl): Failed to transfer file ${nexusUrl}/com/x/top/$%7Brevision%7D/top-$%7Brevision%7D.pom with status code 400 and 'parent.relativePath' points at no local POM @ line 12, column 1
Run Code Online (Sandbox Code Playgroud)
因为它正在寻找字面意思“com.x:top:pom:${revision}”而不是v alue。即使我删除标签也会发生同样的错误。
如果我将以下父级与本地相对路径一起使用,它可以正常工作:
<parent>
<groupId>com.x</groupId>
<artifactId>top</artifactId>
<version>${revision}</version>
<relativePath>../top</relativePath>
</parent>
Run Code Online (Sandbox Code Playgroud)
总之,如果使用没有relativePath的parent:$ {revision},mvn总是尝试按字面解析$ {revision}而不是提供的-D值。
我还尝试了诸如 mvn -Dparent.revision=1.0.0 之类的变体,但也不起作用。
任何指示表示赞赏!
归档时间: |
|
查看次数: |
1750 次 |
最近记录: |