通过HTTPS在git上使用Maven-release-plugin

vba*_*sta 4 git maven maven-release-plugin

我正在尝试通过https上的git使用maven版本插件(出于某些晦涩的原因,我不能在ssh上使用git),但是,我收到以下错误消息:

14:36:52 [ERROR] The git-push command failed.
14:36:52 [ERROR] Command output:
14:36:52 [ERROR] fatal: could not read Username for 'https://my.company.git.host.com': No such device or address
14:36:52 [ERROR] -> [Help 1]
Run Code Online (Sandbox Code Playgroud)

从网上看,我想在pom.xml文件中设置以下属性:

<scm>
    <connection>scm:git:https://my.company.git.host.com/Project/project.git</connection>
    <developerConnection>scm:git:https://my.company.git.host.com/Project/project.git</developerConnection>
</scm>
Run Code Online (Sandbox Code Playgroud)

并将以下内容添加到我的settings.xml中(位于~/.m2文件夹下。我已经通过运行带有-X标志的maven进行了检查)

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                  https://maven.apache.org/xsd/settings-1.0.0.xsd">
    <servers>
        <server>
            <id>my.company.git.host.com</id>
            <username>svc.jenkins.project</username>
            <password>guesswhat</password>
        </server>
    </servers>
</settings>
Run Code Online (Sandbox Code Playgroud)

重要说明:如果我直接在connectiondeveloperConnection属性中添加用户/密码,例如波纹管,则它可以正常工作。

<scm>
    <connection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</connection>
    <developerConnection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</developerConnection>
</scm>
Run Code Online (Sandbox Code Playgroud)

那是对的吗?我的猜测是发布插件与git over https不兼容,但是,我会对此进行一些确认。

bub*_*ter 5

我知道这个问题很老,但是现在发现了。调用maven prepare时,可以在命令行参数中设置用户和密码:

mvn release:prepare -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT -Dtag=my-tag1.2 -Dusername=YYYYY -Dpassword=XXXXXX
Run Code Online (Sandbox Code Playgroud)

与mavern-release-plugin 2.5.3一起使用

问候,


vba*_*sta 3

经过一番研究,我的结论是,当与 https 连接一起使用时,发布插件无法从外部文件恢复密码。因此,我发现的最好方法是在 url 中提供密码,格式如下:

<scm>
    <connection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</connection>
    <developerConnection>scm:git:https://user:password@my.company.git.host.com/Project/project.git</developerConnection>

</scm>
Run Code Online (Sandbox Code Playgroud)