Maven Release Plugin挂在git push上

时间:2014-10-30 03:05:08

标签: java git maven

我正在按照here说明如何发布到Sonatype的说明,我遇到了mvn release:prepare步骤的问题。它取决于这一步,然后它停滞不前:

[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin
[INFO] Executing: cmd.exe /X /C "git push git@github.com:NicholasAStuart/Maven-Mule-REST-Plugin.git master:master"
[INFO] Working directory: C:\Users\Nicholas\git\Maven-Mule-REST-Plugin

我自己手动运行该命令并询问我的密码短语,但我认为这就是拖延发布插件的原因。这是一台Windows机器。我如何能够提示我,或者我可以在CLI参数中将其提供给mvn?

3 个答案:

答案 0 :(得分:4)

maven-release-plugin在推送到非ssh安全存储库时也会显示相同的问题行为(例如,像Artifactory这样的repo管理器中的任何自己配置的http或https存储库)如果您错过了将凭据添加到Maven过程。

所以,如果您使用http(s)总是检查您是否已将凭据添加到Maven流程作为Maven Release插件的参数,如...

mvn release:prepare -Dusername=ANYBODY -Dpassword=XXX

答案 1 :(得分:1)

您需要运行ssh-agent,才能自动为您提供密码。

ssh-add "/c/Users/YourUsename/.ssh/id_rsa"

了解更多信息:" Maven - Error Releasing Code to GitHub (Hangs After Push)"。

答案 2 :(得分:0)

关注这些instructions on GitHub以获取无密码的SSH:

步骤1:检查SSH密钥

ls -al ~/.ssh

步骤2:生成新的SSH密钥

ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
# Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter]

Enter passphrase (empty for no passphrase): [Type a passphrase]
# Enter same passphrase again: [Type passphrase again]

# start the ssh-agent in the background
ssh-agent -s
# Agent pid 59566
ssh-add ~/.ssh/id_rsa

步骤3:将SSH密钥添加到GitHub

clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

第4步:测试一切

ssh -T git@github.com
# Attempts to ssh to github