【问题标题】:maven release plugin with git don't work in sub folders带有 git 的 maven 发布插件在子文件夹中不起作用
【发布时间】:2013-10-16 17:40:02
【问题描述】:

我们在使用 git 和 maven-modules 的 maven-release-plugin 时遇到问题。

我们的项目结构如下:

pom.xml(ApplicationTest and ApplicationConf are modules)

ApplicationWeb

---pom.xml(parent pom in root folder)

ApplicationTest

---pom.xml(parent pom in root folder)

ApplicationConf

---pom.xml(All environments are modules. This has no parent pom)

---ConfDev

-------pom.xml(parent ApplicationConf)

---ConfTst

-------pom.xml(parent ApplicationConf)

---ConfAcc

-------pom.xml(parent ApplicationConf)

---ConfPrd

-------pom.xml(parent ApplicationConf)

现在我们想发布开发配置(父级已经发布)。这通过在 ApplicationConf/ConfDev/pom.xml 上执行 maven 发布。

现在发布准备失败了,因为它在想要推送所做的更改时使用了错误的 git url。它将我们想要发布的 pom 的工件 id 附加到 git url。

http://gitrepourl/git_repo.git/artifact-id

我们在 ApplicationConf 的 pom 中定义了 scm 设置,因此是所有环境的根。

<scm>
  <developerConnection>scm:git:http://gitrepourl/git_repo.git</developerConnection>
</scm>

我们是否有错误的项目结构、错误的设置或者这是 maven-release-plugin 中的错误?

使用的版本:

maven-release-plugin 2.3.2 和 2.4.1

Maven 3.0.5

可能的解决方案:

从配置父 pom 中删除所有配置项目作为模块,并添加到每个 pom 更多 scm 信息,所以它看起来像这样:

<scm>
<url>https://github.com/XXX/YYY</url>
<connection>scm:git:ssh://git@github.com/XXX/YYY.git</connection>
<developerConnection>scm:git:ssh://git@github.com/XXX/YYY.git</developerConnection>

现在我可以在每个 pom 上执行发布。这是正确的解决方案吗?

【问题讨论】:

    标签: git maven maven-release-plugin maven-module


    【解决方案1】:

    Maven 自动将子模块 artifactId 添加到 scm/connection-URLs。 要修复它,您必须将 scm-Node 从父模块复制到每个子模块。

    【讨论】:

      猜你喜欢
      • 2011-10-19
      • 2012-08-30
      • 2012-05-28
      • 2012-10-14
      • 2014-05-30
      • 2015-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多