如何使用不同的临时组 ID 进行 Maven 部署?

发布于 2025-01-12 10:24:27 字数 996 浏览 1 评论 0原文

一些背景:

  • 我已将不属于我的外部 github 存储库的 master 分支复制到个人存储库中
  • 该存储库包含一个 Java 项目,并使用 Maven 进行构建和编译
  • 所有中定义的组 ID pom.xml 文件是 org.mylibrary (假设)
  • 部署到 Artifactory 时,部署完成到 myrepo/org/mylibrary/...

我愿意部署到:

  • myrepo/org/myorganization/mylibrary

但我想避免编辑所有 pom.xml 文件,并替换包含以下内容的所有行: org.mylibrary 和: org.myorganization.mylibrary

我通过 distributionManagement 元素配置部署:

<distributionManagement>
<repository>
  <name>releases</name>
  <id>deployment.credentials</id>
  <url>https://artifactory.lab.myorg.org/artifactory/myrepo</url>
</repository>
</distributionManagement>

解决此问题的干净方法是什么?替换所有 pom.xml 文件中的 groupId 定义就可以解决问题,但是,如上所述,这是我想避免的事情。

谢谢!

Some background:

  • I have copied the master branch of an external github repository, not owned by me, into a personal repository
  • This repo contains a Java project and uses Maven for building and compilation
  • The group ID defined in all pom.xml files is org.mylibrary (let's assume)
  • When deploying to Artifactory, the deployment is done to myrepo/org/mylibrary/...

I'd like to deploy instead to:

  • myrepo/org/myorganization/mylibrary

but I would like to avoid editing all the pom.xml files, and replacing all lines containing:
<groupId>org.mylibrary</groupId>
with:
<groupId>org.myorganization.mylibrary</groupId>.

I'm configuring the deployment via the distributionManagement element:

<distributionManagement>
<repository>
  <name>releases</name>
  <id>deployment.credentials</id>
  <url>https://artifactory.lab.myorg.org/artifactory/myrepo</url>
</repository>
</distributionManagement>

What's a clean way of solving this? Replacing the groupId definition in all pom.xml files does the trick, but, as said, that's something I want to avoid.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

葬シ愛 2025-01-19 10:24:27

部署到任何存储库时,Artifactory 使用 布局是为此存储库配置的。默认情况下,对于 Maven 存储库,Artifactory 使用“maven-default”布局。

我建议您首先添加您请求的布局,然后 配置您的具有新创建布局的存储库

我希望这些信息对您有所帮助。

When deploying to any repository, Artifactory utilizes the layout that is configured for this repository. By default, for Maven repositories, Artifactory uses the "maven-default" layout.

I would recommend you to first add your requested layout and then configure your repository with the newly created layout.

I hope this information is found helpful.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文