Build - Ivy

Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.

Setup

Download
unpack zip file -> copy the jar file into ANT_HOME/lib

Run
If you use ant 1.6.0 or superior, you can then simply: go to the src/example/hello-ivy dir and run ant (if the build is successful, you have successfully installed Ivy!)

Repository

Resolver

Function

There are two types of resolvers:

Default Resolvers:

local	standard	Filesystem resolver points to $HOME/.ivy2/local
shared	standard	Filesystem resolver points to $HOME/.ivy2/shared
public	standard	Ibiblio resolver points http://repo1.maven.org/maven2
main	composite	Chain and Dual resolver to shared and public
default	composite	Chain resolver to local and main

Searching Priority:

Ant-Ivy Tasks

Workflow

ivy-work-flow

Dependency Management

Ivy uses the maven 2 repository by default.

Using Ivy Module Configuration

It allows you to group artifacts and give the group a meaning.

For example, you have a project with 2 parts: A and B. Alice have another project with 3 parts: Alice-X, Alice-Y, Alice-Z.

So you create a module configuration:

e.g. your project ivy.xml

<ivy-module version="1.0">
    <info organisation="org.apache" module="my-project"/>
    <configurations>
    	<conf name="only-a" description="only provide part a"/>
    	<conf name="only-b" description="only provide part b"/>
    	<conf name="both-a-and-b" extends="only-a; only-b" description="provide both part a and b"/>
    </configurations>
    <publications>
    	<artifact name="my-project-part-a" type="jar"  conf="only-a" ext="jar"/>
    	<artifact name="my-project-part-b" type="jar"  conf="only-b" ext="jar"/> 	
    </publications>
    <dependencies>
        <dependency org="junit" name="junit" rev="3.8"/>
    </dependencies>
</ivy-module>

When Alice pull dependencies from your project, she can specify which part they want.

e.g. Alice’s project ivy.xml

<ivy-module version="1.0">
    <info organisation="org.apache" module="alice-app"/>
    
    <configurations>
       	<conf name="alice-x" visibility="private" description="only need A" />
    	<conf name="alice-y" description="only need B" />
    	<conf name="alice-z" description="need A and B" />    
    </configurations>
    
    <dependencies>
        <dependency org="org.apache" name="filter-framework" rev="latest.integration" 
            conf="alice-x -> only-a; alice-y -> only-b; alice-z -> both-a-and-b"/>
    </dependencies>
</ivy-module>

http://ant.apache.org/ivy/history/latest-milestone/tutorial/conf.html

Fork me on GitHub