[英]Maven won't use public key to deploy
I'm using SSH to deploy my Java artifacts to a server. 我正在使用SSH将我的Java工件部署到服务器。 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). 我设置了密钥,以便我可以交互式SSH连接到服务器而无需密码,但是当我尝试运行“
mvn deploy
”或“ mvn release:perform
”命令时,它会挂起(我假设是密码)提示)。
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. 我的
~/.m2/settings.xml
文件包含服务器的用户名(因为它与我的本地用户名不同)并引用了需要不同用户的服务器的id
。
Are you sure your settings.xml
provides everything required? 您确定您的
settings.xml
提供了所需的一切吗? Did you declare your privateKey
(and the passphrase
if necessary)? 您是否声明了您的
privateKey
(以及必要时的passphrase
)? 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>
In your distributionManagement section, try using "scpexe://" in your url instead of "scp://". 在您的distributionManagement部分中,尝试在您的网址中使用“scpexe://”而不是“scp://”。
This calls the standard scp program (assuming it is on your path), instead of using the Java implementation of scp that is built into Maven. 这会调用标准的scp程序(假设它在你的路径上),而不是使用内置在Maven中的scp的Java实现。 Standard scp uses ssh-agent (which, in Ubuntu, starts automatically when you log in through GDM) for public-key auth.
标准scp使用ssh-agent(在Ubuntu中,当您通过GDM登录时自动启动)用于公钥验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.