Using Ivy with Springs repository and other Maven repositories

We use Apache Ivy in the office now and I thought I’d give it a proper whirl at home. In the office we have our repository to store all the libraries we have in our environment and so the setting up of resolvers etc is all taken care off. Out in the real world you need to do this yourself, but the beauty of Ivy is its simple. First up I’m using Eclipse 3.4 with the IvyDE plugin. With those installed I created a new Java Project and then set about creating my ivy.xml. For this project there are a few requirements I wanted.

  1. I want to use Spring for config
  2. I want to have a play with Compass – the lucene abstraction

Out of the box Ivy will use the “ibiblio” resolver which makes use of the Ibiblio’s Maven repository. This is not really the greatest starting point as its not so easy to find stuff in. Spring however have their own repository with a lot of open source libraries and is much easier to search So my ivy.xml file looks like:

< ?xml version="1.0" encoding="ISO-8859-1"?>
<ivy -module version="2.0">

	<info organisation="matt" module="compassTest" status="integration"></info>

		<dependency org="org.springframework" name=""
		<dependency org="org.compass-project" name="compass" rev="2.2.0-M2"></dependency>


Very simply I want to use Springs context support classes and I want to have play with Compass. In order to get this all to work I needed to create my own ivy-settings.xml with some new resolvers. First I need to add Springs repository resolvers (Doc’d here), then I need to add Compass’s Maven repo and finally Compass depends on a version of Lucene not in Springs repository so I need to add in ibiblio’s Maven2 repository. My final ivy-settings.xml file looks like:

< ?xml version="1.0" encoding="ISO-8859-1"?>
	<settings defaultResolver="spring.compass.ibiblio" checkUpToDate="true"></settings>
		<chain name="spring.compass.ibiblio">
			<url name="com.springsource.repository.bundles.release">
				<ivy pattern=";organisation&#93;/&#91;module&#93;/&#91;revision&#93;/&#91;artifact&#93;-&#91;revision&#93;.&#91;ext&#93;"></ivy>
				<artifact pattern=";organisation&#93;/&#91;module&#93;/&#91;revision&#93;/&#91;artifact&#93;-&#91;revision&#93;.&#91;ext&#93;"></artifact>
			<url name="com.springsource.repository.bundles.external">
				<ivy pattern=";organisation&#93;/&#91;module&#93;/&#91;revision&#93;/&#91;artifact&#93;-&#91;revision&#93;.&#91;ext&#93;"></ivy>
				<artifact pattern=";organisation&#93;/&#91;module&#93;/&#91;revision&#93;/&#91;artifact&#93;-&#91;revision&#93;.&#91;ext&#93;"></artifact>
			<ibiblio name="compass" m2compatible="true" root=""></ibiblio>
			<ibiblio name="ibiblio" m2compatible="true"></ibiblio>


After plugging the above into Eclipse and setting up my IvyDE classpath container to use the new ivy-settings.xml file all was good. Simples!

Posted Under

3 thoughts on “Using Ivy with Springs repository and other Maven repositories

  1. Great start, exactly what I was looking. The spring repo is excellent too.

    I have a trivial problem though. I placed ivysettings.xml into .ivy2 folder (default home folder) and when I run ant, I get this

    No ivy:settings found for the default reference ‘ivy.instance’. A default instance will be used

    I figured out how to exclude sources only. In build.xml, use a type qualifier.

  2. At last! An example that just works.
    I’ve been trying to get this to work for hours.
    Thanks heaps.

Leave a Reply