Sunday, June 21, 2009

Authenticating When Using the SCM Plugin

If you are using the SCM plugin with Mercurial then you will likely need to pass the username and password to it. This can be done with the following arguments to the mvn command:

"-Dusername=<username> -Dpassword=<password>"

You also can create a server element in your 'settings.xml' file (in ~/.m2) which has an id that matches the host part of the SCM url, then set the username/password in the respective elements. This'll keep you from having to put in the values on the command line again and again.

<server>
<id>www.blueleftistconstructor.com</id>
<username>rob</username>
<password>pass</password>
</server>

When using the release plugin I've always had to use this technique to 'push' the changeset from my local mercurial repo to the remote one.

Note that one unfortunate side effect here is that the HG Maven plugin WILL OUTPUT YOUR CREDENTIALS IN CLEAR TEXT!!!

This doesn't bother me all that much since I run a pretty tight ship, but if this violates your comfort level you may be out of luck as far as the release plugin goes.