Maven 中的多个部署 [英] Multiple deployments in maven

查看:28
本文介绍了Maven 中的多个部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个内部工件存储库.目前,所有快照都将部署在那里.我们还希望拥有一个具有 Web 界面的不同服务器,并希望将创建的工件复制到其中.

We have a internal artifactory repository. At the moment all snapshots will be deployed there. We also want to have a different server with a web interface, and want to copy the to it the created artifacts.

对于我们的构建,我们使用 Hudson,但构建后操作将工件部署到 Maven 存储库"与 scp 一起不起作用.所以存在以其他一些优雅的方式来做这件事的问题.为什么 maven 不能拥有多个分发存储库?有什么想法吗?

For our builds we use Hudson, but the post-build action "Deploy artifacts to Maven repository" together with scp doesn't work. So there is the question of doing it in some other elegant way. Why isn't maven able to have several distribution repositories? Any ideas?

最好的事情是,如果 artifactory 支持在每次新部署后(自动!)增量导出到标准 Maven 存储库.

The nicest thing would be if artifactory would support an (automatic!) incremental export to a standard maven repository after each new deployment.

推荐答案

我认为 maven 不支持为单个配置文件部署到多个存储库,但配置文件可能会更改存储库的 id 和 url.

I don't think maven supports deploying to multiple repositories for a single profile, but perhaps profiles could change the id and urls of the repository.

  <distributionManagement>
    <repository>
      <id>${repo-id}</id>
      <name>${repo-name}</name>
      <url>${repo-url}</url>
    </repository>
  </distributionManagement>

Maven 部署

然后使用配置文件选择要部署到的存储库:

Then use profiles to pick which repo to deploy to:

<profiles>
  <profile>
    <id>repo1</id>
    <activation>
      <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
      <repo-id>repo1</repo-id>
      <repo-name>Repo1 Name </repo-name>
      <repo-url>http://url.com/maven2</repo-url>
    </properties>
  </profile>
  <profile>
    <id>repo2</id>
    <properties>
      <repo-id>repo2</repo-id>
      <repo-name>Repo2 Name </repo-name>
      <repo-url>http://url2.com/maven2</repo-url>
    </properties>
  </profile>
</profiles>

Maven 配置文件

这篇关于Maven 中的多个部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆