我们对带有 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 上执行发布。这是正确的解决方案吗?