[英]Using maven-release-plugin with git over HTTPS
我试图通过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]
从网上看,我想在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>
并将以下内容添加到我的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>
重要说明 :如果直接在connection
和developerConnection
属性中添加用户/密码(例如波纹管),它将正常工作。
<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>
那是对的吗? 我的猜测是发布插件与git over https不兼容,但是,我会对此进行一些确认。
我知道这个问题很老,但是现在发现了。 调用maven prepare时,可以在命令行参数中设置用户和密码:
mvn release:prepare -DreleaseVersion=1.2 -DdevelopmentVersion=2.0-SNAPSHOT -Dtag=my-tag1.2 -Dusername=YYYYY -Dpassword=XXXXXX
与mavern-release-plugin 2.5.3一起使用
问候,
经过一些研究,我的结论是,当与https连接一起使用时,发布插件无法从外部文件中恢复密码。 因此,我发现最好的方法是在网址中提供密码,格式如下:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.