【问题标题】:Override maven release repository durning deploy在部署期间覆盖 Maven 发布存储库
【发布时间】:2012-10-21 06:17:27
【问题描述】:

我正在开发一个开源库,并希望将版本发送到内部工件服务器。我一直在使用 maven 的 distributionManagement 并覆盖 altDeploymentRepository 指向内部服务器(所以它永远不会在 pom 中)。当我使用deploy:deploy 时,这工作正常,但是当我使用 maven 发布插件时,这似乎被忽略了。

mvn clean -DaltDeploymentRepository=central::default::internalhost deploy ## works
mvn clean -DaltDeploymentRepository=central::default::internalhost release:perform ## fails, doesn't pick up this setting

发布插件运行部署时如何通过命令行覆盖存储库?

【问题讨论】:

  • 不能编辑POM重新定义分发管理信息吗?
  • 试试这个mvn release:perform -Darguments=-DaltDeploymentRepository=myvalue
  • 感谢@yorkw,效果很好!
  • @yorkw 您应该将此作为完整答案发布,因为它是正确的。
  • central::default::internalhost 是什么意思?它不应该像一些网址吗?

标签: maven plugins release


【解决方案1】:

使用

altReleaseDeploymentRepository

它的语法与 altDeploymentRepository 相同

更多内容:https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html

【讨论】:

  • 虽然您将如何在其中传递用户名/密码?
  • @old-monk 格式为“some-id:url”,服务器“some-id”的凭据在您的~/.m2/settings.xml 文件中。
【解决方案2】:

mvn 发布:执行 -Darguments=-DaltDeploymentRepository=myvalue

诀窍是:'-Dargument'

有效的解决方法在 yorkw 注释中(适用于 2.7 版中的 maven-deploy-plugin) 当您使用更高版本的 maven-deploy-plugin(例如 2.8)时,请使用参数 altReleaseDeploymentRepository。

maven-deploy-plugin doc

【讨论】:

    【解决方案3】:

    在您正在使用的版本上,您应该编辑 pom 以更改分发管理部分以使用您的内部存储库。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-04-26
      • 2011-09-15
      • 1970-01-01
      • 2020-12-08
      • 2019-02-15
      • 1970-01-01
      • 2022-01-07
      • 1970-01-01
      相关资源
      最近更新 更多