Ivy-svn: An Ivy resolver for Subversion

Overview

Ivy is a dependency manager for Java which is based on Ant and can be integrated into Ant builds to allow for retrieval of artifacts (e.g. third-party jar files) which your project may depend on as well as publication of artifacts (e.g. your own .jar/.war/.ear files etc.) that your build generates. We have developed a custom Ivy dependency resolver (Ivy-svn) which uses Subversion for the storage of retrieved and published files (Subversion is not supported "out of the box" by Ivy itself). The key benefits of this resolver for existing Subversion users are:

Latest news

Download

Version Release Date Binary Source
1.4 2008-02-02 ivysvnresolver-1.4-bin.tgz ivysvnresolver-1.4-src.tgz
1.3 2008-01-08 ivysvnresolver-1.3-bin.tgz ivysvnresolver-1.3-src.tgz
1.2 2007-12-19 ivysvnresolver-1.2-bin.tgz ivysvnresolver-1.2-src.tgz
1.1 2007-11-08 ivysvnresolver-1.1-bin.tgz ivysvnresolver-1.1-src.tgz
1.0 2007-10-22 ivysvnresolver-1.0-bin.tgz ivysvnresolver-1.0-src.tgz

Installation

  1. Copy all the third party libraries (Ivy, Trilead and SVNKit) from the "lib" folder to ANT_HOME/lib/ or to somewhere on your CLASSPATH. If you are upgrading from a previous version of Ivy-svn please remove any older versions of these libraries.
  2. Copy ivysvnresolver.jar into ANT_HOME/lib/ or make sure it is on your CLASSPATH.
  3. Create a standard ivy.xml file for your project declaring your dependencies, publications etc.
  4. Create an ivysettings.xml file containing a "svn" resolver element and set various properties on it as described below
If you are upgrading from ivy-svn 1.3 or below you will also need to:
  1. Remove the contents of your local ivy2 cache (this is located in ~/.ivy2 on Linux, remove the folder and all its contents).
  2. Remove ANT_HOME/lib/ganymed.jar and previous versions of Ivy jar files from ANT_HOME/lib/.

Configuration

  1. Create an ivysettings.xml file as described below, removing attributes and/or replacing words which are all uppercase with values that suit your setup.
    <ivysettings>
    
      <typedef name="svn" classname="fm.last.ivy.plugins.svnresolver.SvnResolver"/>
    
      <resolvers>
        <svn name="ivysvn" username="${svn.user.name}" userpassword="${svn.user.password}
            keyfile="${ssh.keyfile}" port="${ssh.port}" passphrase="${ssh.keyfile.passphrase}"
            certfile="${ssl.certfile}" repositoryURL="PROTOCOL://HOSTNAME/PATH_TO_YOUR_SVN_ROOT">
          <ivy pattern="PROTOCOL://HOSTNAME/PATH_TO_YOUR_IVY_REPOSITORY/[organisation]/[module]/[revision]/ivy.xml"/>
           <artifact pattern="PROTOCOL://HOSTNAME/PATH_TO_YOUR_IVY_REPOSITORY/[organisation]/[module]/[revision]/[artifact].[ext]"/>
        </svn>
      </resolvers>
    
      <settings defaultResolver="ivysvn" />
        <modules>
          <module organisation="YOUR_ORGANISATION" name="ivysvnresolver" resolver="ivysvn"/>
        </modules>
    </ivysettings>	
    
    For more information on this file refer to this. Make sure that this file is included in your Ant build file before you call any Ivy ant targets like ivy:retrieve, ivy:publish etc.
    <ivy:settings file="ivysettings.xml" />
    
  2. Remove, add and set attributes of the "svn" element to suit your environment as per the table below (we recommend setting them via properties in your ant build file) and the above examples are coded accordingly.

    Attribute Description Required
    name Name of the resolver Always
    username Subversion user name Always
    userpassword Subversion password For svn+ssh:// and http(s):// connections that require username and password authentication
    keyfile Path to SSH key file For svn+ssh:// connections that require username and keyfile authentication
    passphrase The SSH key file passphrase (if any) For svn+ssh:// connections that require username and keyfile authentication with a keyfile requiring a passphrase
    port The SSH port For svn+ssh:// connections where the SSH server is listening on a port other than 22
    certfile Path to client side certificate file For https:// connections that require client side certificates for authentication
    repositoryURL A base repository URL (containing protocol, host and path to the root of the repository) If the root of the Subversion repository is located more than one directory level deep and you are using http(s)://


    So an example ivysettings.xml for a Subversion repository accessed over SSH on the default SSH port using SSH username and password authentication would be:

    <ivysettings>
    
      <typedef name="svn" classname="fm.last.ivy.plugins.svnresolver.SvnResolver"/>
    
      <resolvers>
        <svn name="ivysvn" username="${svn.user.name}" userpassword="${svn.user.password}>
          <ivy pattern="svn+ssh://example.com/svn/someproject/[organisation]/[module]/[revision]/ivy.xml"/>
          <artifact pattern="svn+ssh://example.com/svn/someproject/[organisation]/[module]/[revision]/[artifact].[ext]"/>
        </svn>
      </resolvers>
    
      <settings defaultResolver="ivysvn" />
        <modules>
          <module organisation="some_organisation" name="ivysvnresolver" resolver="ivysvn"/>
        </modules>
    </ivysettings>	
    

Usage

Provided you have followed the installation and configuration steps above you should be able to publish and retrieve files to and from your Ivy Subversion repository using the standard Ivy Ant tasks. For retrieving you will obviously need to set up your own repository in Subversion and add files and folders containing whatever your projects depend on. For publishing you will need write access to the repository.

Third party libraries

The Ivy Subversion resolver uses the following third-party libraries, the version numbers indicate the versions that the Ivy Subversion resolver was built and tested against, your mileage with other versions may vary. The resolver has been tested and used with Sun's JDK 6 Update 3 on Linux but, being Java, should work on other platforms. If you experience any problems please contact us.

Licensing

The Ivy Subversion resolver is available under an Apache v2.0 license

Feedback

If you have any problems, questions, feature requests etc. feel free to e-mail adrian@last.fm.