使用maven-release-plugin标记并提交到非源

发布于 2024-08-28 23:29:04 字数 1110 浏览 6 评论 0原文

当我发布项目时,我希望与比通常在开发过程中更广泛的人群共享源代码。代码通过 Git 存储库共享。为此,我使用了以下方法:

在我的本地 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。

所以问题是:

  1. 最佳实践:我应该在我的私人存储库(来源)中标记和提交,然后手动推送到公共吗?
  2. 我可以让 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:

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:

  1. Best practice: Should I just be tagging and committing in my private repo (origin), and pushing to public manually?
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2024-09-04 23:29:04

当 scm.connection 存储库与源不同时发布已在 maven-release-plugin (或关联的 git 插件)版本 2.0 中修复。为了更改到此版本,我将以下内容添加到我的 POM 中:

<project>
    ...
    <build>
        <plugins>
            ...
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.0</version>
            </plugin>
            ...
        </plugins>
    </build>
    ...
</project>


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:

<project>
    ...
    <build>
        <plugins>
            ...
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.0</version>
            </plugin>
            ...
        </plugins>
    </build>
    ...
</project>


Incidentally, Maven was picking up maven-release-plugin version 2.0-beta-9 as being more recent than 2.0.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文