gpt4 book ai didi

maven - 将 Maven Artifact 名称保留在 maven-install-plugin 上(默认安装)

转载 作者:行者123 更新时间:2023-12-05 07:46:33 30 4
gpt4 key购买 nike

我尝试在 Artifact 名称中包含 git commit hash 以区分 CI 场景中的快照版本。git hash 已成功包含在我项目的 target/文件夹中,但在最后的 maven 步骤中,它将 Artifact 复制到我的 HOME/.m2/repositories 文件夹中,并将名称更改为 ARTIFACTID-VERSION-mta.jar。

如何从包含提交哈希的目标/文件夹中保留文件名?

我查看了 maven-install-plugin,但找不到“finalName”属性或类似的东西。

[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ projectname ---
[INFO] Installing PROJECTDIR/pom.xml to ~/.m2/repository/GroupIdDir/projectname/1.0.1/projectname-1.0.1.pom
[INFO] Installing PROJECTDIR/target/projectname-1.0.1-d054c42-mta.jar to ~/.m2/repository/GroupIdDir/projectname/1.0.1/projectname-1.0.1-mta.jar

我希望最后一行是

[INFO] Installing PROJECTDIR/target/projectname-1.0.1-d054c42-mta.jar to ~/.m2/repository/GroupIdDir/projectname/1.0.1/projectname-1.0.1-d054c42-mta.jar

Controlling maven final name of jar artifact没有解决问题,因为它修改了输出文件夹。

最佳答案

这可能是因为存储库布局。

Repository Layout Definition

This is the final layout for the repository available in Maven 2.x and its related Ant tasks.

For primary artifacts: /$groupId[0]/../${groupId[n]/$artifactId/$version/$artifactId-$version.$extension

For secondary artifacts: /$groupId[0]/../$groupId[n]/$artifactId/$version/$artifactId-$version-$classifier.$extension

参见 https://cwiki.apache.org/confluence/display/MAVENOLD/Repository+Layout+-+Final

关于maven - 将 Maven Artifact 名称保留在 maven-install-plugin 上(默认安装),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40654953/

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