mvn site:deploy and SSH
Recently I've been going in deep at work using the Maven2 release plugin, I have to say this plugin does the job really well, updating all pom.xml files with the new version references, including the SCM urls and dependencies, there's even excellent SVN integration in that it knows about trunk/tags/branches when updating to the next release .. taking care of this manually would quickly become very cumbersome.
Anyway, I got stuck actually deploying the new release to the server, this is done by calling release:perform by executing the deploy:deploy and site:deploy goals. The former goal works fine, although it's slow as heck, but the latter one simply does not work.
I was able to trace it back to issue MDEPLOY-9, which is supposed to be fixed in the next stable release (which is going to be 2.0). So I tried to build the 2.0-SNAPSHOT myself (the ones found here are way too old so they had the same problem), without success .. apparently it requires Maven 2.1-SNAPSHOT, but if you disable this requirement the build will fail on the maven reporting api (again version 2.1-SNAPSHOT is needed, which you would need to build yourself too).
So I abandoned this and went looking for another solution, and I found one, an easy one which will help me in other areas too: ssh-agent. The problem was that deploy:site is attempting to call ssh in batch mode in order to work on the host server, but since the settings.xml is ignored it won't be able to pass in the password in order to access your private key. Running Putty's PAGEANT won't work either because you would need to have deploy:site read the settings.xml in that case.
Fortunately there's a solution when you are running Linux (or Cygwin), just run the ssh-agent (which is similar to PAGEANT) and add your key, it will prompt you for the password only once, from that point on the password will no longer be asked, effectively allowing the deploy:site goal to continue. I've found good instructions here.
This is basically what I did:
1. called ssh-agent and copy the output in my ~/.bashrc
2. called ssh-add
3. entered the password I was prompted for
4. made sure the key was property collected by calling ssh-agent -l
That's it .. when I was finished I was able to execute site:deploy without any further issues.
Anyway, I got stuck actually deploying the new release to the server, this is done by calling release:perform by executing the deploy:deploy and site:deploy goals. The former goal works fine, although it's slow as heck, but the latter one simply does not work.
I was able to trace it back to issue MDEPLOY-9, which is supposed to be fixed in the next stable release (which is going to be 2.0). So I tried to build the 2.0-SNAPSHOT myself (the ones found here are way too old so they had the same problem), without success .. apparently it requires Maven 2.1-SNAPSHOT, but if you disable this requirement the build will fail on the maven reporting api (again version 2.1-SNAPSHOT is needed, which you would need to build yourself too).
So I abandoned this and went looking for another solution, and I found one, an easy one which will help me in other areas too: ssh-agent. The problem was that deploy:site is attempting to call ssh in batch mode in order to work on the host server, but since the settings.xml is ignored it won't be able to pass in the password in order to access your private key. Running Putty's PAGEANT won't work either because you would need to have deploy:site read the settings.xml in that case.
Fortunately there's a solution when you are running Linux (or Cygwin), just run the ssh-agent (which is similar to PAGEANT) and add your key, it will prompt you for the password only once, from that point on the password will no longer be asked, effectively allowing the deploy:site goal to continue. I've found good instructions here.
This is basically what I did:
1. called ssh-agent and copy the output in my ~/.bashrc
2. called ssh-add
3. entered the password I was prompted for
4. made sure the key was property collected by calling ssh-agent -l
That's it .. when I was finished I was able to execute site:deploy without any further issues.



0 Comments:
Post a Comment
<< Home