Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.


After having generating a website locally, you can deploy it to a webserver. Before starting, make sure the POM properties siteAddress and siteDirectory are set correctly. If you are allowed to access the source of other projects build with Maven from the same webserver, take a look at their settings.

SSH (Secure Shell)


SSH is a secure protocol which can be used to deploy the website. It is based on the private-public key paradigm. From a private key a public key can be generated, but not the other way around. A private key should be kept safe, but its public key can be shared with anyone. They are used for:

  • Encryption: The sender encrypts data with the receiver's public key and the receiver decrypts it with his private key.
  • Authentication: The sender signs data with his private key and the receiver authenticates it with the sender's public key.

There are several private-public key algorithms, such as RSA.

SSH client

Maven currently does not contain an SSH client, so you need to install one yourself. Many Linux distributions come with OpenSSH. Windows users can use Cygwin with the optional installation of OpenSSH. Other SSH clients can be found on the net.

Afterwards set the maven.ssh.executable property properly. When using OpenSSH through Cygwin, remember to call all maven goals that require SSH from the Cygwin command line.

Authentication configuration

Encryption is mostly done behind the scenes, but authentication requires some work. If your local username doesn't match with your remote username, use the maven.username property to set the correct SSH username.

If your administrator doesn't supply you with the private key, you can generate one with most SSH clients. For example to generate an RSA key pair with OpenSSH:

ssh-keygen -t rsa

It asks for a passphrase, which is a long password.

To be able to authenticate you, the remote server needs to have your public key stored. The manner on getting it there depends on your organization's security policy. In some cases the server administrator adds it manually, in other cases you can upload it through a web interface (for example on SourceForge).

Using the ssh deploy goal

If your private key requires a passphrase, simply calling the site:sshdeploy goal will cause Maven to hang. Instead you need to authenticate to the SSH agent before calling Maven. For example, with the filename being id_rsa in the directory ~/.ssh using OpenSSH:

ssh-agent bash
ssh-add ~/.ssh/id_rsa
maven site:sshdeploy

Note that you need to build the site first.