Here is what you need to get the job done:
Google and search for "putty download".
Once you download them, place them in a folder called putty and move that folder to your root drive (C:\). The next thing that you should do is add that folder to the PATH. Not sure how to do that?
- press the windows key and 'pause break' at the same time.
- A system properties panel will appear. Click on the 'Advanced' tab.
- Click on the 'Environment Variables' button.
- Locate the PATH variable from the System variables portion of the panel and choose 'Edit'.
- Append, without quotations, ';c:\putty;' to the end of the PATH value.
- close the panels and you are done!
Now you need to create a private key from the remote server that you would like to deploy your files to.
- ssh into the remote machine
- execute the following command on the remote machine
ssh-keygen -b 1024 -f ssh_host_key -N '' -t rsa
This will create a file called ssh_host_key.
- On your local machine, create a folder called c:\ssh and place the file, ssh_host_key, in that folder from the remote machine.
The key that we generated on the remote machine will now be used to create one that is compatible with putty. We will now use puttygen to create a 'putty' private key.
- Double click the file puttygen.
- Make sure that you select you select 'ssh-2 RSA' at the bottom of the page.
- Next choose, Conversion -> import.
- Select c:\ssh\ssh_host_key.
- Save the generated key (save both the public/private key) in c:\ssh.
Most of the 'hard' stuff is now done. Next we will add our remote server to our local maven configuration. To do this, we will have to modify the file settings.xml.
The settings.xml file is usually located in
c:\Documents and Settings\
Before proceeding, you should back up the file. Open settings.xml in Wordpad and add the following fragment of xml into the file:
That piece of xml goes in the servers portion of the file. Add it and modify the bold pieces of the text.
<password>your password here</password>
That's really all there is to do. However, if you are lazy, like myself, then create a windows batch file that does the deploying for you!
Below is one that I use. You will have to modify the lines in bold. Run it without arguments first, to have it display the usage!
if "%1"=="" GOTO ERROR
if "%2"=="" GOTO ERROR
echo There was an error deploying file.
echo %0 jar pom [repository_id]
if "%3"=="" set REPO=remote-repository-id
REM should be on one line!
mvn deploy:deploy-file -Dfile=%1 -DpomFile=%2 -Durl=scpexe://remote_server_domain/:/remote/path/to/maven/ -DrepositoryId=%REPO%
REM end one line