10

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 username) and references the id of the server that requires the different user.

2 Answers 2

10

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>
1
  • I needed the <passphrase/> element. This is pretty darn disappointing! Why won't it read the passphrase from my Ubuntu keychain just like mvn does? Commented May 9, 2010 at 2:03
5

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.

1
  • 2
    You also need to use wagon-ssh-external in that case. Commented Sep 4, 2012 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.