Maven不会使用公钥进行部署 [英] Maven won't use public key to deploy
问题描述
我正在使用SSH将Java工件部署到服务器.我已经设置了密钥,以便可以在不需要密码的情况下以交互方式SSH到服务器,但是当我尝试运行"mvn deploy
"或"mvn release:perform
"命令时,它会挂起(我假设是密码)提示).
I'm using SSH to deploy my Java artifacts to a server. I have the keys set up so that I can interactively SSH to the server without requiring a password, but when I try to run the "mvn deploy
" or "mvn release:perform
" commands, it hangs (at what I assume is the password prompt).
我的~/.m2/settings.xml
文件包含服务器的用户名(因为它不同于我的本地用户名),并引用了需要其他用户的服务器的id
.
My ~/.m2/settings.xml
file contains the username for the server (because it is different than my local username) and references the id
of the server that requires the different user.
推荐答案
您确定您的settings.xml
提供了所有必需的内容吗?您是否声明了privateKey
(如有必要,还声明了passphrase
)?像这样:
Are you sure your settings.xml
provides everything required? Did you declare your privateKey
(and the passphrase
if necessary)? Something like this:
<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
http://maven.apache.org/xsd/settings-1.0.0.xsd">
...
<servers>
<server>
<id>server001</id>
<username>my_login</username>
<privateKey>${user.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase> <!-- if required -->
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>
...
</settings>
这篇关于Maven不会使用公钥进行部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!