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).
My ~/.m2/settings.xml
file contains the username for the server (because it is different than my local usern开发者_Python百科ame) and references the id
of the server that requires the different user.
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>
In your distributionManagement section, try using "scpexe://" in your url instead of "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. Standard scp uses ssh-agent (which, in Ubuntu, starts automatically when you log in through GDM) for public-key auth.
精彩评论