Wednesday, January 24, 2007

Maven2 SSH site deploy Tip

Am gonna walk you into how to achieve deployment of maven site from a windows XP machine to a Redhat box, assuming you already have installed maven2 and the know-how to execute commands.

These are the stuffs which you need to perform:

1. Configure your POM.xml by adding the distribution management tag:

< distributionmanagement>
< site >
< id > redhatServer < /id >
< url > scp://HOST /var/www/html/site < /url >
</site >
< /distributionmanagement >

Note: HOST is the ip address to your webserver.

The id element must be a unique name to represent your site.
The url element must point to the location on your remote server where you want to deploy your site. Do note that scp:// is prefixed , this specifies that we are using ssh for tansfer.

2. Edit your settings.xml file ,which should be located under C:\Documents and Settings\YOUR_USERNAME\.m2 , by adding the following:

< server >
< id > redhatServer < /id >
< username > USERNAME_ON_REMOTE_SERVER < /username >
< password > PASSWORD_ON_REMOTE_SERVER < /password >
< filePermissions > 664 < /filePermissions >
< directoryPermissions > 775 < /directoryPermissions >
< /server >
< /servers >

USERNAME_ON_REMOTE_SERVER and PASSWORD_ON_REMOTE_SERVER should correspond to your username and password on the remote server (RedHat box).

3. Run mvn site site:deploy

This should now start creating your site and deploying it to your remote server.

4. If you get a nagging prompt that keeps coming like the following :

The authenticity of host '' can't be established.
RSA key fingerprint is 14:93:e7:25:e5:cb:fe:d9:8b:3f

Are you sure you want to continue connecting? (yes/no):

Then all you need to do is create a directory called .ssh under C:\Documents and Settings\YOUR_USERNAME\ .

You would require to use the mkdir .shh

Thats all that is required to perform the site deploy, hope it will help you out . I know this post is going to be boring for my not so techie readers :).


Anonymous said...

...or use scpexe:// which also works with you ssh-agent and public key authentication.

Anonymous said...

Good article. I have the following doubts,
1. where should i keep the pscp.exe file on the system
2. How do i give the port number for the ssh connection.