Terry C. Martin

Sunday, November 05, 2006

Maven2 + SCM + Subversion = Not as obvious as it should be

I'm finally trying to get on board with the whole Maven2 bandwagon because I can see a glimmer of the usefulness it could provide for development. But, I'm really unhappy with how unintuitive it seems to do certain things.

I guess I finally figured out how to get it to checkout a project from a subversion repository. Here's what I had to do:

  • Download the subversion client. I got mine from http://subversion.tigris.org/ and installed it from an executable binary (Windows OS). This is KEY!!! Seems obvious in retrospect, that you'd have to download a subversion client, but I really thought the Maven SCM plugin knew how to do subversion, or knew how to download a 'provider' that knew how to do subversion, already.
  • I then was told by maven2 to create a directory in my home directory (on windows 2000, this was c:\Documents and Settings\Terry\) called .svn and create a file called svn-settings.xml in it. That file contains the following:

    C:\Program Files\Subversion\bin


    The path in between the configDirectory elements is the path to the bin directory of my installed subversion client, but I actually doubt that's correct. I don't really think it mattered what I have in there. Probably the important thing was to have the directory called ".svn" in the right place, and maybe the file physically existing too. Without those things, maven complained that it could find a provider for subversion.
  • Now you can execute a maven command to checkout a project from a subversion repository. I was trying to checkout the Apache Trinidad (Oracle's donated ADF Faces components), so I typed: mvn scm:checkout -DconnectionUrl=scm:svn:http://svn.apache.org/repos/asf/incubator/adffaces/trunk
    Now one thing about this is, if the project you're trying to download, is under a secure connection, a la 'https' (and there may be some other situations too), apparently this type of maven command won't work 'out-of-the-box' because there will be some certificate or encryption key stuff that wants to happen and the maven plugin won't let the subversion client interact with you to prompt you as to whether or not you want to accept the key or whatevere it is that it's trying to verify with you. There may be a way around that (like properly setting that configDirectory setting in the svn-settings.xml file perhaps), but I'm not currently wasting time to figure out how. In this case, just use the subversion client directly (the first time you checkout that project) and it'll prompt you to accept the key thingy. After that, you can use maven cuz the key will have been added to your accepted keys. Also, you can specify where the project should end up on your local file system by adding a -DcheckoutDirectory (I think). Look at this page for options:
    http://maven.apache.org/scm/plugins/checkout-mojo.html
    I'm too tired to try anymore stuff with this right now.
I just wanted to write down some hints how to get it going cuz I saw a lot of postings of others, asking how to get it going too. It really pisses me off that the documentation just doesn't seem to put it all together for you. Oh well, what'cha gonna do... it's free!

0 Comments:

Post a Comment

<< Home