Maven 发布插件 : Doing the git push via https

标签 maven maven-release-plugin

在我们的 jenkins box 上,我们使用 https 而不是 ssh 克隆我们的 repo。但是当我运行

mvn release:prepare 

命令它通过 ssh 推送提交。我很确定这是因为在我的 scm 部分的 pom.xml 中有

<connection>scm:git:ssh:<internal package></connection>
    <developerConnection>scm:git:ssh:<internal package></developerConnection>

我很确定我可以将其更改为类似 https: 但是我应该将用户名和密码放在哪里以便它可以连接?

最佳答案

凭据存储在 mavens 设置文件中,因此不会暴露在 pom 中。

使用您的 GitHub 用户/密码将服务器部分添加到您的 ~/.m2/settings 文件,即

<servers>
    <server>
        <id>GitHub</id>
        <username>[User]</username>
        <password>[Password]</password>
    </server>
</servers>

添加属性 <project.scm.id>GitHub</project.scm.id>到 pom 中的属性部分。 对服务器 Id 的引用在发布插件配置中没有详细说明,而是在顶级 pom 属性中。

关于Maven 发布插件 : Doing the git push via https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38115084/

相关文章:

java - Elasticsearch 与 Java API 集成和 SpringBoot 异常

java - 为什么这么红? IntelliJ 似乎认为无法找到/解决每个声明/方法

java - 使用 Maven Relelase 插件准备发布阶段出错

java - Maven安装guvnor找不到ResourceType变量

java - 使用 maven 与 ant : Differences 编译相同的枚举

java - 获取maven项目的所有依赖项

svn - 有没有办法使用 maven 自动重新集成功能分支?

maven - 尽管已转移,但仍出现错误 "Failed to transfer file *.jar with status code 409"

Maven 版本 : Prepare/Perform after Rollback incorrectly succeeds with wrong content

带有参数化版本的 Maven 发布插件