Skip to main content

Configuring Ivy to fetch Luntbuild artifacts

Posted by dcengija on April 8, 2006 at 9:22 AM PDT

Every project should use some kind of continuous integration tool. As Martin Fowler writes (and we all know who Mr. Fowler is), 'Developing a disciplined and automated build process is essential to a controlled project.' (read more). If you use Luntbuild as a continuous integration tool, and Ivy as your depencency manager of choice, this article could help you to integrate those two tools.

Luntbuild is an extremely powerful build automation and management tool. It is plain simple to install, and almost as much simple to configure and use. With Luntbuild, Snapshot, Nightly and Release build configuration is a matter of minutes.

Products of Luntbuild 'schedules' -- build process instances -- are called artifacts, and are available via Luntbuild's browser-based interface. However, if you want those artifacts to be available to other tools via plain HTTP, you should configure Luntbuild to place them somewhere appropriate. Then you configure Ivy to fetch those artifacts from every project which needs them.

Say, you have MyLib project and Release schedule, which produces myLib.jar, myLib-src.zip and myLib-doc.zip. Version numbers are dynamically calculated to look like 'release-1.1.4' but you want to simply place those build products into your IDE's classpath without reconfiguring it, so there's no version number in artifacts' names.

The following screenshot shows how your Luntbuild configuration might look like:
snapshot13.jpg

After running Release schedule, you'll have directory called MyLib/Release/release-1.1.4/artifacts in Luntbuild's publish directory, with myLib*.* files in it.

In order to be able to fetch those artifacts via Ivy, first you have to make them available via plain HTTP (no login/password). The easiest way is to configure Luntbuild to place the artifacts somewhere else, e.g. in your Intranet's web server htdocs directory. On Luntbuild Properties page set the following option:

snapshot14.jpg

Now the artifacts are available via e.g. http:// intranet/repository/MyCompany/MyLib/Release/release-1.1.4.

It's time to configure Ivy. The configuration is plain simple, all you need is a few ivy properties. Place them in e.g. MyCompany-ivy.properties and load via standard Ant properties loading mechanisms:

ivy.ivyrep.default.artifact.root=http://intranet/repository/MyCompany/
ivy.ivyrep.default.artifact.pattern=[module]/Release/release-[revision]/artifacts/[artifact](-[type]).[ext]

Now we have to configure ivy.xml in projects which need myLib.jar etc. and we're almost done:

<?xml version="1.0"?>
<ivy-module version="1.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://jayasoft.org//ivy/ivy.xsd"
    >
    <info organisation="MyCompany" module="Libs"/>
    <dependencies>
        <dependency name="MyLib" rev="1.1.4">
            <artifact name="myLib" type="" ext="jar"/>
            <artifact name="myLib" type="src" ext="zip"/>
            <artifact name="myLib" type="doc" ext="zip"/>
        </dependency>
    </dependencies>
</ivy-module>

And as the final step, be sure to call Ivy's Ant task:

<ivy:retrieve pattern="${ivy.lib.dir}/[organization]/[artifact](-[type]).[ext]"/>

Called this way, Ivy will place artifacts in MyCompany folder under ${ivy.lib.dir}, which is simply lib/ by default.

More details on very powerful Ivy mechanisms are available on Ivy's website.

Enjoy your automated build and dependency management combination.

Related Topics >>