使用maven-release-plugin标记并提交到非源
当我发布项目时,我希望与比通常在开发过程中更广泛的人群共享源代码。代码通过 Git 存储库共享。为此,我使用了以下方法:
- 远程公共存储库 - 每周左右将发布的代码推送到此处(http:// /example.com/public)
- 远程私有存储库 - 非发布代码每天都会推送到这里 (http ://example.com/private)
在我的本地 git 存储库中,我定义了以下远程:
origin http://example.com/private
public http://example.com/public
我当前正在尝试配置 maven-release-plugin 来管理构建的版本控制,并管理标记和将代码推送到公共存储库。在我的 pom.xml 中,我列出了
<scm><connection>scm:git:http://example.com/public</connection></scm>
删除此行将导致 mvn release:prepare 失败)
但是,在调用
mvn release:clean release:prepare release:perform
Maven 时,会调用
git push origin tagname
而不是推送到 POM 中指定的 URL。
所以问题是:
- 最佳实践:我应该在我的私人存储库(来源)中标记和提交,然后手动推送到公共吗?
- 我可以让 Maven 推送到我选择的存储库,而不是默认为 origin 吗?我觉得这是由
的要求所暗示的。 中的元素。
When I do a release of my project, I want to share the source with a wider group of people than I normally do during development. The code is shared via a Git repository. To do this, I have used the following:
- remote public repository - released code is pushed here, every week or so (http://example.com/public)
- remote private repository - non-release code is pushed here, more than daily (http://example.com/private)
In my local git repository, I have the following remotes defined:
origin http://example.com/private
public http://example.com/public
I am currently trying to configure the maven-release-plugin to manage versioning of the builds, and to manage tagging and pushing of code to the public repository. In my pom.xml, I have listed the <scm/> as follows:
<scm><connection>scm:git:http://example.com/public</connection></scm>
(Removing this line will cause mvn release:prepare to fail)
However, when calling
mvn release:clean release:prepare release:perform
Maven calls
git push origin tagname
rather than pushing to the URL specified in the POM.
So the questions are:
- Best practice: Should I just be tagging and committing in my private repo (origin), and pushing to public manually?
- Can I make Maven push to the repository that I choose, rather than defaulting to origin? I felt this was implied by the requirement of the <connection/> element in <scm/>.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当 scm.connection 存储库与源不同时发布已在 maven-release-plugin (或关联的 git 插件)版本 2.0 中修复。为了更改到此版本,我将以下内容添加到我的 POM 中:
Incidentally, Maven was picking up maven-release-plugin version 2.0-beta-9 as being more recent than 2.0.
Releasing when the scm.connection repository is different to the origin is fixed in the version 2.0 of maven-release-plugin (or the associated git plugins). To change to this version, I added the following to my POM:
Incidentally, Maven was picking up maven-release-plugin version 2.0-beta-9 as being more recent than 2.0.