Overview topOverviewIvy is a free java based dependency manager, with powerful features such as transitive dependencies, ant integration, maven repository compatibility, continuous integration, html reports and many more.After several months of development, users feedback and testing, Ivy 1.0 is available ! Apart its strong dependency management engine, Ivy also benefits from a growing user community, a public repository of common ivy files, an evolving set of surrounding tools and plugins, and professional quality services directly from the authors. Main features
Testimonials"Now that Ivy 1.0 is out, I’d strongly encourage every Java developer to pull it down and consider using it to manage dependencies in their Ant builds. As far as I’m concerned, it’s a complete no-brainer." Read moreColin Sampaleanu, core developer of Spring "Ivy's a great library... I've just gone through and implemented a multi-module build using Ivy for full transitive dependency management..." Read more "Currently, our application uses more than 40 3rdparty jars. [...] With Ivy, I now have a full accounting of what libraries our project relies on directly. [...] We now have clear understanding of our dependency tree" Read more Scott Haug, core developer of jobster.com
Tools and pluginsGreat tools and plugins help you leverage the power of Ivy:Ivy CruiseControl Plugin let you integrate ivy in the famous continuous integration tool from thoughtworks: cruisecontrol. Ivy Eclipse UI strongly help eclipse users to write their ivy files, with structural and data completion. Coming soon: Subversion Dependency Resolver, let you use subversion to store your libraries Ivy Eclipse Classpath, let you use ivy files as a library container Main benefitsSimplicityFor simple cases, ivy is really simple to use. Declare your dependencies, and that's all. See the very simple example below to check yourself.Ivy can thus be used to bring the dependency management feature of maven to ant build file, for those of you who already use ant and who do not want to setup a maven project. But Ivy does not stop here, as you can see in the following main benefits... Transitive dependencies managementImagine you have a component that you often reuse in your software developments. Imagine that this component has itself dependencies. Then with classical dependencies management, each time you use this component in your software you have to declare it as a dependency, but also all its dependencies.With ivy it's different: you simply write a dependency file once for the component, declaring its own dependencies, then anytime you want to use this component you simply have to declare a dependency on it. And this is even more powerful if the component your software depends on changes of dependencies during its own development. Then, without ivy, you have to maintain all your components dependencies declaration each time the dependencies of this component change. With ivy, you update the ivy file of the component and that's it ! Note: if you want to quickly start using this feature or simply see it in action with real world examples, check the official repository: ivyrep Continuous integration readyAre you working in a continuous integration environment ? No ? You should ;-)If you are working in a continuous integration environment, and if you have many projects that depend one on each other, then you are maybe experiencing the dependency management nightmare... Fortunately, ivy is there to help ! With ivy you can declare that a component depends on the latest version of another component. Knowing that, ivy will search for the latest version of the dependency whenever you ask it to do so. This latest version is computed by ivy simply either by checking the date of the dependency versions or by comparing versions as text (either lexicographically or with an algorithm close to the one used in php version_compare function). You have nothing special to do to benefit from this feature: install ivy, configure it, write your dependency files, and that's it ! Simple exampleThe simplest way to use ivy is to call it from your ant build file. Here's the 3 steps easiest way to first use it, assuming you already have ant installed:1. Download and installDownload the latest version here, unpack the downloaded zip file wherever you want, and copy the ivy jar file in your ant lib directory (ANT_HOME/lib).2. Describe your dependenciesTo describe your dependencies, you just have to create a file named ivy.xml in your project base directory (as known by ant).Write your dependencies description in this file, as here :
<ivy-module version="1.0">
<info organisation="mycompany" module="mycomponent"/>
<dependencies>
<dependency name="commons-lang" rev="2.0"/>
<dependency name="log4j" rev="1.2.8"/>
</dependencies>
</ivy-module>
The version given at the beginning of the file is the ivy file specification
version, it should thus always be 1.0 with current ivy version.In the info tag you describe the component for which you are describing dependencies. Then you just have to list the dependencies your component has. In order to work with as little configuration as possible, the name of the dependencies should be the name of the directory under maven ibiblio repository, and the revision should be the one found in the jars directory in this same repository. 3. Call ivy from your ant build fileIf you use ant 1.6.0 or superior version, this is really simple. You just have to add this attribute to your project tag :xmlns:ivy="antlib:fr.jayasoft.ivy.ant"Then call ivy retrieve task in the target you like. Example: <target name="resolve"> <ivy:retrieve/> </target>You now can call this target with ant. You should then see that ivy created a lib directory in your project, containing the dependencies jar downloaded from ibiblio ! That's it, you can now use them to build a classpath or anything you want... and you are still far far away from ivy possibilities. Check the tutorial to discover some of them, and do not forget to read the reference documentation to go even further in your knowledge of the power of ivy ! About this siteThis site allows you to comment each page to share your experience about any feature or documentation. You have to be registered to post a comment, it's simple, quick, free, and you will not be spammed with e-mails, don't worry. You can also use the forum to ask questions ( registration required).You can find documentation either on this site and in the distribution. But prefer the site, it is always more up to date and you can post and view comments on each page. A single page documentation is also available. Hello ivy topStarting with ivyIn this example, we will see the easiest way to use ivy. No configuration or other complicated files to write, only the list of libraries the project will use.The ivy.xml fileThis file is used to describe, the dependencies of the project on other libraries. Here is the sample :<ivy-module version="1.0">
<info organisation="jayasoft" module="hello-ivy" /> <dependencies> <dependency name="commons-lang" rev="2.0" /> </dependencies> </ivy-module> <project xmlns:ivy="antlib:fr.jayasoft.ivy.ant" name="hello-ivy" default="run"> ... <!-- ================================= target: resolve ================================= --> <target name="resolve" description="--> retreive dependencies with ivy"> <ivy:retrieve /> </target> </project> Running the projectTo run the sample, open a dos (or shell) window, and go under the hello-ivy example directory. Then, on the command prompt, just run ant :
I:\hello-ivy>ant
Buildfile: build.xml
resolve:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
no configuration file found, using default...
:: resolving dependencies :: jayasoft/hello-ivy-working@xmen
confs: [default]
downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar(2.0) ...
..................................... (165kB)
[SUCCESSFUL ] apache/commons-lang-2.0/commons-lang.jar[jar] (4688ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 1 | 0 | 0 || 1 | 1 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/hello-ivy
confs: [default]
1 artifacts copied, 0 already retrieved
run:
[mkdir] Created dir: I:\hello-ivy\build
[javac] Compiling 1 source file to I:\hello-ivy\build
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
BUILD SUCCESSFUL
Total time: 8 secondsWhat happened ?Without any configuration, other than it's default configuration, ivy retreive files from the maven ibiblio libraries repository. That's what happened here. The resolve task has downloaded the commons-lang.jar file from ibiblio, then copied it to the ivy cache and then dispatch it in the default library directory of the project : the lib dir.Some will say that the task was long to achieve. Yeah, it's true it was, but it has downloaded from the internet the needed file. Let's try to run it again : I:\hello-ivy>ant
Buildfile: build.xml
resolve:
:: resolving dependencies :: jayasoft/hello-ivy-null :: [default]
:: resolution report ::
[default] jayasoft/hello-ivy-working@rahan: 1 artifacts (0 downloaded)
:: retrieving :: jayasoft/hello-ivy :: [default]
run:
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
BUILD SUCCESSFUL
Total time: 1 secondIf you want to check the content of the cache, by default it is put in your user home in a .ivy-cache directory. And now, if you want to generate a report detailing all the dependencies of your module, you can call the report target, and check the generated file in the build directory. You should obtain something looking like this. You are now ready to go to the next tutorials to go one step beyond using ivy transitive dependencies management. Using IvyRep topStarting with ivyIn this example, we will see the easiest way to use ivy and benefit from its transitive dependencies feature. No configuration or other complicated files to write, only the list of libraries the project will use.The ivy.xml fileThis file is used to describe, the dependencies of the project on other libraries. Here is the sample :<ivy-module version="1.0">
<info organisation="jayasoft" module="hello-ivy" /> <dependencies> <dependency org="apache" name="commons-lang" rev="2.0" /> <dependency org="apache" name="commons-cli" rev="1.0" /> </dependencies> </ivy-module> <project xmlns:ivy="antlib:fr.jayasoft.ivy.ant" name="hello-ivy" default="run"> ... <!-- ================================= target: resolve ================================= --> <target name="resolve" description="--> retreive dependencies with ivy"> <ivy:retrieve /> </target> </project> Running the projectTo run the sample, open a shell window, and go under the ivyrep example directory. Then, on the command prompt, just run ant :
I:\ivyrep>ant
Buildfile: build.xml
resolve:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
no configuration file found, using default...
:: resolving dependencies :: jayasoft/ivyrep-example-working@xmen
confs: [default]
downloading http://www.ibiblio.org/maven/commons-cli/jars/commons-cli-1.0.jar(1.0) ...
...... (31kB)
[SUCCESSFUL ] apache/commons-cli-1.0/commons-cli.jar[jar] (1437ms)
downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar(2.0) ...
..................................... (165kB)
[SUCCESSFUL ] apache/commons-lang-2.0/commons-lang.jar[jar] (5640ms)
downloading http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.jar(1.0) ...
..... (21kB)
[SUCCESSFUL ] apache/commons-logging-1.0/commons-logging.jar[jar] (1250ms)
:: resolution report ::
:: evicted modules:
apache/commons-lang-1.0 by [apache/commons-lang-2.0] in [default]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 4 | 3 | 2 | 1 || 3 | 3 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/ivyrep-example
confs: [default]
3 artifacts copied, 0 already retrieved
run:
[mkdir] Created dir: I:\ivyrep\build
[javac] Compiling 1 source file to I:\ivyrep\build
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
BUILD SUCCESSFUL
Total time: 16 secondsWhat happened ?Without any configuration, other than it's default configuration, ivy uses the ivyrep resolver. This resolver looks for ivy files on ivyrep, and for artifacts on ibiblio. That's what happened here.The resolve task has found an ivy file on ivyrep for commons-cli 1.0. This ivy file indicates that commons-cli 1.0 depends on commons-lang 1.0 and commons-logging 1.0. The resolve task detects the conflict between the revision 2.0 of commons-lang that is asked in the ivy above, and the revision 1.0 required in commons-cli. With no particular conflict manager, the 2.0 is selected, and the 1.0 is evicted. The 1.0 being evicted, it is not downloaded at all. The resolve task has then downloaded the commons-cli 1.0, commons-logging 1.0 and commons-lang.jar 2.0 files from ibiblioand put them to the ivy cache. Then the retrieve task has copied them in the default library directory of the project : the lib dir. Some will say that the task was long to achieve. Yes, it's true it was, but it has downloaded from the internet the needed files. Let's try to run it again :
I:\ivyrep>ant
Buildfile: build.xml
resolve:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
no configuration file found, using default...
:: resolving dependencies :: jayasoft/ivyrep-example-working@xmen
confs: [default]
:: resolution report ::
:: evicted modules:
apache/commons-lang-1.0 by [apache/commons-lang-2.0] in [default]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 4 | 0 | 0 | 1 || 3 | 0 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/ivyrep-example
confs: [default]
0 artifacts copied, 3 already retrieved
run:
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
BUILD SUCCESSFUL
Total time: 2 secondsIf you want to check the content of the cache, by default it is put in your user home in a .ivy-cache directory. Check the next tutorials to see how to configure this. Multiple resolvers toppurposeThis example is an illustration of how artefacts can be retreived by multiple resolvers. Using multiple resolvers is very important when using continous integration. Indeed, in such environements, you can use multiple repositories and so multiple resolvers to retreive both released versions of projects than continous integrated versions produced for example with cruise-control. In our example, we will just show how to use two resolvers, one on a local repository and one using ibiblio repository.project descriptionthe project : chained-resolversThe project is very simple and contains only one test class : example.HelloIt depends on two libraries apache commons-lang and a little test library (sources are included in jar file). The test library is used by the project to uppercase a string, and commons-lang is used to capitalize the same string. Here is the content of the project :
<ivy-module version="1.0"> <info organisation="jayasoft" module="chained-resolvers" /> <dependencies> <dependency org="apache" name="commons-lang" rev="2.0" /> <dependency name="test" rev="1.0" /> </dependencies> </ivy-module> the ivy configurationThe ivy configuration is made in the config directory it contains only one file : ivyconf.xml. Let's analyse it.<ivyconf>
<conf defaultResolver="chain-example" /> <resolvers> <chain name="chain-example"> <filesystem name="libraries"> <artifact pattern="${ivy.conf.dir}/repository/[artifact]-[revision].[type]" /> </filesystem> <ibiblio name="ibiblio" /> </chain> </resolvers> </ivyconf> the conf tagThis tag initializes ivy with some parameters. Here only one is used, the name of the resolver to use by default.the resolvers tagUnder this tag, we can find the description of the resolvers that ivy will use. In our example, we have only one resolver, called "chain-example", which is quite special as it defines a list (a chain) of resolvers. The resolvers put in the chain are :
walkthroughstep 1 : preparationOpen a DOS or shell window, and go to the "chained-resolvers" directory.step 2 : clean directory treeOn the prompt type : antThis will clean up the entire project directory tree and ivy cache. You can do it each time you want to clean up this example. step 3 : run the projectGoto chainedresolvers-project directory. And simply run ant.I:\chained-resolvers\chainedresolvers-project>ant
Buildfile: build.xml
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/chained-resolvers-working@xmen
confs: [default]
downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar(2.0) ...
.................................... (165kB)
[SUCCESSFUL ] apache/commons-lang-2.0/commons-lang.jar[jar] (5390ms)
downloading file:/I:/chained-resolvers/config/repository/test-1.0.jar(1.0) ...
. (1kB)
[SUCCESSFUL ] jayasoft/test-1.0/test.jar[jar] (16ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 2 | 2 | 0 | 0 || 2 | 2 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/chained-resolvers
confs: [default]
2 artifacts copied, 0 already retrieved
run:
[mkdir] Created dir: I:\chained-resolvers\chainedresolvers-project\build
[javac] Compiling 1 source file to I:\chained-resolvers\chainedresolvers-project\build
[java] standard message :example world !
[java] capitalized by org.apache.commons.lang.WordUtils : Example World !
[java] upperCased by test.StringUtils : EXAMPLE WORLD !
BUILD SUCCESSFUL
Total time: 9 secondsDual resolver topDual Resolver TutorialThis tutorial presents the use of the DualResolver, a feature introduced in the version 0.6 of Ivy.Dual Resolver is used when ivy files can be found in a repository while artifacts are in another. It is especially useful to use full power of ivy (including transitive dependencies) with the ibiblio repository for artifacts. The problem with the maven ibiblio repository is that it does not contain ivy files. Since transitive dependencies are based upon ivy files, using the ibiblio resolver does not permit to use transitive dependencies. The solution to this problem is to store your own repository only for ivy files, and use ibiblio for artifacts. That's what is done in this tutorial. project descriptionLet's have a look at the src/example/dual directory in your ivy distribution.It contains a build file and 3 directories:
the dual projectThe project is very simple and contains only one test class : example.HelloIt depends on two libraries: apache commons-lang and apache commons-httpclient. Here is the content of the project :
<ivy-module version="1.0">
<info organisation="jayasoft" module="hello-ivy" /> <dependencies> <dependency org="apache" name="commons-httpclient" rev="2.0.2" /> <dependency org="apache" name="commons-lang" rev="2.0" /> </dependencies> </ivy-module> As you can see, nothing special here... Indeed, it's the philosophy of ivy to keep ivy files independent of the way dependencies are retrieved. the ivy configurationThe ivy configuration is made in the config directory it contains only one file : ivyconf.xml. Let's analyse it.<ivyconf>
<conf defaultResolver="dual-example" /> <resolvers> <dual name="dual-example"> <filesystem name="ivys"> <ivy pattern="${ivy.conf.dir}/../repository/[module]-ivy-[revision].xml" /> </filesystem> <ibiblio name="ibiblio" /> </dual> </resolvers> </ivyconf> Here we configure one resolver, the default one, which is a dual resolver. This dual resolver has two sub resolvers : the first is what is called the "ivy" resolver of the dual resolver, and the second one is what is called the "artifact" resolver. It is important that the dual resolver exactly has two sub resolvers in this given order. The ivy resolver, here a filesystem one, is used only to find ivy files. The configuration given in this resolver says that all ivy files are in the same directory, named like that: [module]-ivy-[revision].xml. If we check the repository directory, we can confirm that it contains a file named commons-httpclient-ivy-2.0.2.xml. It fulfills the given pattern and will thus be find by this resolver. The artifact resolver is simply an ibiblio one, and will thus try to find required artifacts in the maven ibiblio repository. walkthroughstep 1 : preparationOpen a DOS or shell window, and go to the "dual" directory.step 2 : clean upOn the prompt type : antThis will clean up the entire project directory tree (compiled classes and retrieved libs) and ivy cache. You can do it each time you want to clean up this example. step 3 : run the projectGoto project directory. And simply run ant.
I:\dual\project>ant
Buildfile: build.xml
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/hello-ivy-working@xmen
confs: [default]
downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar(2.0) ...
.....
.........
..........
...........
. (165kB)
[SUCCESSFUL ] apache/commons-lang-2.0/commons-lang.jar[jar] (8032ms)
downloading http://www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-2.0.2.jar(2.0.2) ...
...........
......
....
..........
............
........ (220kB)
[SUCCESSFUL ] apache/commons-httpclient-2.0.2/commons-httpclient.jar[jar] (10031ms)
downloading http://www.ibiblio.org/maven/commons-logging/jars/commons-logging-1.0.4.jar(1.0.4) ...
......... (37kB)
[SUCCESSFUL ] apache/commons-logging-1.0.4/commons-logging.jar[jar] (1469ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 3 | 3 | 1 | 0 || 3 | 3 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/hello-ivy
confs: [default]
3 artifacts copied, 0 already retrieved
run:
[mkdir] Created dir: I:\dual\project\build
[javac] Compiling 1 source file to I:\dual\project\build
[java] standard message : hello ivy !
[java] capitalized by org.apache.commons.lang.WordUtils : Hello Ivy !
[java] head status code with httpclient: 200
[java] now check if httpclient dependency on commons-logging has been realized
[java] found logging class in classpath: interface org.apache.commons.logging.Log
BUILD SUCCESSFUL
Total time: 24 seconds
As you can see, ivy not only downloaded commons-lang and commons-httpclient, but also commons-logging. Indeed, commons-logging is a dependency of httpclient, as we can see in the httpclient ivy file found in the repository directory: <ivy-module version="1.0">
<info organisation="apache" module="commons-httpclient" revision="2.0.2" status="release" publication="20041010174300" /> <dependencies> <dependency name="commons-logging" rev="1.0.4" conf="default" /> </dependencies> </ivy-module> So everything worked well, ivy file has been found in the repository directory and artifacts have been downloaded from ibiblio. You now just have to write ivy files for the module you often use, and they will be much easier to use... And imagine a world in which each module delivers also an ivy file. Since it is independent of the way to retrieve dependencies, it would made all dependencies handling much easier, wouldn't it ? Projects dependency toppurposeThis example is an illustration of dependency between two project. The dependant project declares that it uses the standalone one. We will illustrate two things :
the projects usedthe project : standaloneThe standalone project is very simple. It depends on the apache library commons-lang and contains only one class : standalone.Main which provides two services :
<ivy-module version="1.0"> <info organisation="jayasoft" module="standalone" /> <dependencies> <dependency org="apache" name="commons-lang" rev="2.0" /> </dependencies> </ivy-module> the project : dependingThe project depending is very simple too. It declares only one dependency on the latest version of the standalone project and it contains only one class depending.Main which make 2 things :
<ivy-module version="1.0">
<info organisation="jayasoft" module="depending" /> <dependencies> <dependency name="standalone" rev="latest.integration" /> </dependencies> </ivy-module> the ivy configurationThe ivy configuration is made in the config directory wich contains 2 files :
<ivyconf>
The file contains four main tags : properties, conf, resolvers and modules.
<properties file="${ivy.conf.dir}/ivyconf.properties" /> <conf defaultCache="${ivy.conf.dir}/ivy-cache" defaultResolver="libraries" /> <resolvers> <filesystem name="projects"> <artifact pattern="${repository.dir}/[artifact]-[revision].[ext]" /> <ivy pattern="${repository.dir}/[module]-[revision].xml" /> </filesystem> <ivyrep name="libraries" /> </resolvers> <modules> <module organisation="jayasoft" name=".*" resolver="projects" /> </modules> </ivyconf> the properties tagThis tag only load some properties for the ivy process in the same manner as ant will do it.the conf tagThis tag is in charge to initialize some parameters for ivy process. The directory that ivy will use to cache (to store) artifacts found will be in a sub directory called ivy-cache of the directory containing the ivyconf.xml file itself. The second parameter, tells ivy to use a resolver called "libraries" as its default resolver. As a recall, a resolver is in charge to resolve an artifact from some information like : the organisation that provides the artifact, the name of the library and the version of the library. More information can be found in the configuration documentation.the resolvers tagThis tag defines the resolvers to use. Here we have two resolvers defined: "projects" and "libraries".The filesystem resolver called "projects" is able to resolve the internal dependencies wanted. The ivyrep resolver called "libraries" is able to find dependencies on ivyrep. the modules tagThe modules tag allows to configure which resolver should be use for which module. Here the configuration only tells to use the "projects" resolver for all modules having for organisation "jayasoft" and any module name (.* regexp matches any module name).For other modules (i.e. all modules not from jayasoft), since there is no special configuration, the default resolver will be used: "libraries". walkthroughstep 1 : preparationOpen a DOS or shell window, and go to the "dependance" directory.step 2 : clean directory treeOn the prompt type : antThis will clean up the entire project directory tree. You can do it each time you want to clean up this example. step 3 : publication of standalone projectGoto standalone directory and publish the projectI:\standalone>ant publish
Buildfile: build.xml
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/standalone-working@xmen
confs: [default]
downloading http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar(2.0) ...
.................................... (165kB)
[SUCCESSFUL ] apache/commons-lang-2.0/commons-lang.jar[jar] (6672ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 1 | 0 | 0 || 1 | 1 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/standalone
confs: [default]
1 artifacts copied, 0 already retrieved
compile:
[mkdir] Created dir: I:\standalone\build\classes
[javac] Compiling 1 source file to I:\standalone\build\classes
jar:
[propertyfile] Creating new property file: I:\standalone\build\classes\version.properties
[jar] Building jar: I:\standalone\build\standalone.jar
publish:
:: delivering :: jayasoft/standalone-working@xmen :: 1 :: release :: Wed Apr 27 08:41:47 CEST 2005
delivering ivy file to I:\standalone/build/ivy.xml
:: publishing :: jayasoft/standalone-working@xmen
published standalone to I:\config\repository\standalone-1.jar
published ivy to I:\config\repository\standalone-1.xml
[echo] project standalone released with version 1
BUILD SUCCESSFUL
Total time: 10 seconds- the delivery of a resolved ivy file to build/ivy.xml. This has been done because by default the publish task not only publishes artifacts but also ivy file. So it has looked to the path where the ivy file to publish should be, using the artifactspattern: ${build.dir}/[artifact].[ext]. For an ivy file, this resolves to build/ivy.xml. Because this file does not exist, it automatically make a call to the deliver task which delivers a resolved ivy file to this destination. - the publication of artifact standalone and resolved ivy file to the repository. Both are mere copy of files found in the current project, more precisely in the build dir. This is because the artifactspattern has been set to ${build.dir}/[artifact].[ext], so standalone artifact is found in build/standalone.jar and ivy file in build/ivy.xml. And because we have asked the publish task to publish them using the "projects" resolver, these files are copied to repository\standalone-1.jar and to repository\standalone-1.xml, respecting the artifact and ivy patterns of our configuration (see above). step 4 : running the depending projectGoto to directory depending and run antI:\depending>ant
Buildfile: build.xml
clean:
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/depending-working@xmen
confs: [default]
[1] jayasoft/standalone
downloading file:/I:/config/repository/standalone-1.jar(1) ...
. (1kB)
[SUCCESSFUL ] jayasoft/standalone-1/standalone.jar[jar] (15ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 2 | 2 | 2 | 0 || 2 | 1 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/depending
confs: [default]
2 artifacts copied, 0 already retrieved
compile:
[mkdir] Created dir: I:\depending\build\classes
[javac] Compiling 1 source file to I:\depending\build\classes
run:
[java] you are using version 1 of class standalone.Main
[java] standard message : i am depending.Main and standalone.Main will do the job for me
[java] [standalone.Main] capitalizing string "i am depending.Main and standalone.Main will do the job for me"
using org.apache.commons.lang.WordUtils
[java] capitalized message : I Am Depending.main And Standalone.main Will Do The Job For Me
BUILD SUCCESSFUL
Total time: 3 seconds
step 5 : new version of standalone projectLike we did before in step 3, publish again the standalone project. This will result as a new version of the project.I:\standalone>ant publish
Buildfile: build.xml
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/standalone-working@xmen
confs: [default]
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 1 | 0 | 0 | 0 || 1 | 0 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/standalone
confs: [default]
0 artifacts copied, 1 already retrieved
compile:
jar:
[propertyfile] Updating property file: I:\standalone\build\classes\version.properties
[jar] Building jar: I:\standalone\build\standalone.jar
publish:
[delete] Deleting: I:\standalone\build\ivy.xml
:: delivering :: jayasoft/standalone-working@xmen :: 2 :: release :: Wed Apr 27 09:17:13 CEST 2005
delivering ivy file to I:\standalone/build/ivy.xml
:: publishing :: jayasoft/standalone-working@xmen
published standalone to I:\config\repository\standalone-2.jar
published ivy to I:\config\repository\standalone-2.xml
[echo] project standalone released with version 2
BUILD SUCCESSFUL
Total time: 2 secondsLet's look at it : I:\dependence\standalone>dir ..\config\repository /w
Le volume dans le lecteur I s'appelle DATA
Le numéro de série du volume est 30E5-91BA
Répertoire de I:\dependence\config\repository
[.] [..] standalone-1.jar standalone-1.xml standalone-2.jar standalone-2.xml
4 fichier(s) 3 936 octets
2 Rép(s) 9 874 350 080 octets libres
I:\dependence\standalone>step 6 : depending got the new versionWhat do we expect about running again the depending project ? Two major things are expected :
I:\depending>ant
Buildfile: build.xml
clean:
[delete] Deleting 3 files from I:\depending
[delete] Deleted 4 directories from I:\depending
configure:
:: Ivy 1.0-rc3 - 20050421161206 :: http://ivy.jayasoft.org/ ::
resolve:
:: resolving dependencies :: jayasoft/depending-working@xmen
confs: [default]
[2] jayasoft/standalone
downloading file:/I:/config/repository/standalone-2.jar(2) ...
. (1kB)
[SUCCESSFUL ] jayasoft/standalone-2/standalone.jar[jar] (0ms)
:: resolution report ::
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 2 | 2 | 2 | 0 || 2 | 1 |
---------------------------------------------------------------------
:: retrieving :: jayasoft/depending
confs: [default]
2 artifacts copied, 0 already retrieved
compile:
[mkdir] Created dir: I:\depending\build\classes
[javac] Compiling 1 source file to I:\depending\build\classes
run:
[java] you are using version 2 of class standalone.Main
[java] standard message : i am depending.Main and standalone.Main will do the job for me
[java] [standalone.Main] capitalizing string "i am depending.Main and standalone.Main will do the job for me"
using org.apache.commons.lang.WordUtils
[java] capitalized message : I Am Depending.main And Standalone.main Will Do The Job For Me
BUILD SUCCESSFUL
Total time: 3 secondsReference topPresentationHere is the reference documentation of Ivy, a simple but powerful dependency manager. In this documentation, you will learn how to:In fact, ivy distinguishes two different steps for describing and get your dependencies: You write ivy files to describe the dependencies of your module, independently of how you retrieve them. Then you configure ivy to indicate it where it can find your dependencies. Thus you can easily share your ivy files, even if you have internal dependencies which are not resolved the same way in your environment as in the target development environment. You just have to have two configurations with the same ivy files. This is really nice when your ivy files are the reference of your module dependencies, which will be soon the case if you like it ! But before learning all of this, it is necessary to learn some vocabulary... TerminologyHere are some terms used in Ivy, with their definitions in Ivy:OrganisationAn organisation is either a company or a simple group of person which produce software. Ivy handle only one level of organisation, so you cannot describe a company hierarchy with this concept. But it is used to group sofware produced by a same team, just to help find and classify them.Examples: apache, ibm, jayasoft ModuleA module in ivy is a piece of software that is reusable, and that follow a unique cycle of revision.Examples: hibernate, ant, ... ArtifactAn artifact is a single file produced by a company when releasing a module. In the java world, common artifacts are jars. In many cases, each revision of a module publish only one artifact (like log4j, for instance), but some of them publish many artifacts dependending on the use of the module (like ant, for instance).RevisionA revision corresponds to one delivery of a module. It can either be a delivery of a release, a milestone, a beta version, a nightly build, or even a continuous build. All of them are considered revisions in ivy.ConfigurationA module configuration is a way to use or construct a module. Some modules may be used in different ways (think about hibernate which can be used inside or outside an application server), and this way may alter the artifacts you need (in the case of hibernate, jta.jar is needed only if it is used outside an application server). Moreover, a module may need some other modules and artifacts only at build time, and some others at runtime. All those differents ways to use or build a module are called in ivy configurations.StatusA module status indicates how stable a module revision can be considered. It can be used to consolidate the status of all the dependencies of a module, to prevent the use of an integration revision of a dependency in the release of your module. Currently, three status are used in ivy:
Main conceptsDependency ResolverA dependency resolver is a pluggable class in ivy which is used to:
Moreover, the fact that it is the responsibility of the resolver to find ivy files and download artifacts help to implement various resolving strategies. As you see, a dependency resolver can be thought as a class responsible of describing a repository. Latest StrategyIvy often needs to know which revision between two has to be considered the "latest". For knowing that, it uses the concept of latest strategy. Indeed, there are several way to consider a revision to be the latest. You can choose an existing one or plug your own.Ivy has three built-in latest strategies: - latest-time: it compares the revisions date to know which is the latest. While this is often a good strategy in terms of pertinence, it has the drawback to be costful to compute with distant repositories. If you use ivyrep, for example, ivy has to ask the http server what is the date of each ivy file before knowing which is the latest. - latest-revision: it compares the revisions as string, using an algorithm close to the one used in the php version_compare function. This algorithm takes into account special meaning of some text. For instance, with this strategy, 1.0-dev1 is considered before 1.0-alpha1, which in turn is before 1.0-rc1, which is before 1.0, which is before 1.0.1. - latest-lexico: it compares the revisions as string, using lexicographic order (the one used by java string comparison). Conflict ManagerA conflict manager is able to select, among a list of module revisions in conflict, a list of revisions to keep. Yes, it can selects a list of revision, even if most conflicts manager select only one revision. But in some cases you will need to keep several revisions, and load in separate class loaders, for example.A list of revisions is said to be in conflict if they correspond to the same module, i.e. the same organisation/module name couple. Ivy comes with 4 built-in conflicts manager, but you can also plug your own: - all: this conflicts manager resolve conflicts by selecting all revisions. Also called NoConflictManager, it does evict any module. - fixed: this conflict manager always select the same revision - latest-time: this conflict manager selects only the 'latest' revision, latest being defined as the latest in time. Note that latest in time is costly to compute, so prefer latest-revision if you can. - latest-revision: this conflict manager selects only the 'latest' revision, latest being defined by a string comparison of revisions as defined by the latest-revision strategy. To have more details on how to setup your conflict managers and on how they work, see ivy file reference. VariablesDuring configuration, ivy allows to define what are called ivy variables. Ivy variables can be seen as ant properties, and are used in a very similar way. In particular, you use a properties tag in the configuration file to load a properties file containing ivy variables and their values.But the main differences between ant properties and ivy variables are that ivy variables can be overriden, whereas ant properties can't, and that they are defined in separate environment. In fact all ant properties are imported into ivy variables when the configuration is done (if you call ivy from ant). This means that if you define an ant property after the call to configure, it will not be available as an ivy variable. On the other hand, ivy variables are NOT exported to ant, thus if you define ivy variables in ivy, do not try to use them as ant properties. To use ivy variables, you just have to follow that same syntax as for ant properties: ${variablename} where variablename is the name of the variable. Moreover, it's also important to understand the difference between ivy variables and ivy pattern tokens. See Patterns chapter below to see what pattern tokens are. Here is a table summing up the default variables availables in ivy:
PatternsIvy patterns are used in many dependency resolvers and ivy tasks, and are a simple way to structure the way ivy works.First let's give an example. You can for instance configure the file system dependency resolver by giving it a pattern to find artifacts. This pattern can be like this: myrepository/[organisation]/[module]/[type]s/[artifact]-[revision].[ext] This pattern indicates that the repository we use is in a directory called myrepository. In this directory we have directories having for name the name of the organisation of the module we look for. Then we have a directory per module, each having for name the name of the module. Then in module directories we find a directory per artifact type (jars, wars, ivys, ...), in which we find artifacts named by the artifact id, followed by an hyphen, then the revision, a dot, and the artifact extension. Not too difficult to understand, isn't it ? That's it, you have understood the pattern concept ! To give a bit more explanation, a pattern is composed of tokens, which are replaced by true values when evaluated for a particular artifact or module. Those tokens are different from variables because they are replaced differently for each artifact, whereas variables are usually given the same value. You can mix variables and tokens in a pattern: ${repository.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext] Before 0.9, the syntax was the same for variables and tokens (${variable} and ${token}). Since 0.9, token use brackets as delimiters ([token]), which makes them easier to distinguish. The tokens available depends on where the pattern is used (will it be evaluated with artifacts or modules, for instance). But here are all the tokens currently available: [organisation] the organisation name [module] the module name [revision] the revision name [artifact] the artifact name (or id) [type] the artifact type [ext] the artifact file extension [conf] the configuration name Difference between type and extension are explained in ivy file documentation. Installation topInstallationDownload the latest version here, unpack the downloaded zip file wherever you want, and copy the ivy jar file in your ant lib directory (ANT_HOME/lib).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 ! If you use ant 1.5.1 or superior, you have to modify the build files in the examples: - remove the namespace section at their head: xmlns:ivy="antlib:fr.jayasoft.ivy.ant" - add taskdefs for ivy tasks: <taskdef name="ivy-configure" classname="fr.jayasoft.ivy.ant.IvyConfigure"/> <taskdef name="ivy-resolve" classname="fr.jayasoft.ivy.ant.IvyResolve"/> <taskdef name="ivy-retrieve" classname="fr.jayasoft.ivy.ant.IvyRetrieve"/> <taskdef name="ivy-publish" classname="fr.jayasoft.ivy.ant.IvyPublish"/>- replace ivy:xxx tasks by ivy-xxx You can now run the build, if it is successful, you have successfully installed Ivy ! If the build is not successful, check the FAQ to see what can be the problem with the ivyrep resolver. Configuration topIvy ConfigurationIn order to work as you want it work, ivy need some configuration. Actually, ivy can work with no configuration at all, but in this case it work only with the ivyrep repository. But ivy is able to work in very different contexts. You just have to configure it properly.Configuration is done through an xml file, usually called ivyconf.xml. To configure ivy from ant, you just have to call the configure task and pass it the path to your configuration file (see configure task documentation for details). Here is an example of configuration file : <ivyconf>
<properties file="${ivy.conf.dir}/ivyconf-file.properties" /> <conf defaultCache="${cache.dir}" defaultResolver="ibiblio" checkUpToDate="false" /> <resolvers> <ibiblio name="ibiblio" /> <filesystem name="internal"> <ivy pattern="${repository.dir}/[module]/ivy-[revision].xml" /> <artifact pattern="${repository.dir}/[module]/[artifact]-[revision].[type]" /> </filesystem> </resolvers> <modules> <module organisation="jayasoft" name=".*" resolver="internal" /> </modules> </ivyconf> Mainly, the configuration enables to configure the default cache directory used by ivy and the dependency resolvers that it will use to resolve dependencies. Configuration file structureThe configuration file is structured in some parts and left other open. Indeed each resolver has its own structure, thus it's not the configuration file itself which define the structure for the resolvers.ivyconf properties conf typedef latest-strategies resolvers conflict-managers modules module ivyconfTag: ivyconfRoot tag of any ivyconf file. Child elements
propertiesTag: propertiesLoads a properties file into ivy variables. See variables chapter above for details about ivy variables. Attributes
confTag: confConfigures some important ivy info: default cache, default resolver, ... Default cache is used whenever a cache is not provided. It usually points to a directory in your filesystem. Default resolver is used whenever nothing elese is configured in the modules section of the configuration file. It should give the name of a dependency resolver defined in the resolvers section of the configuration file. Default latest strategy and conflict manager can also be configured here. validate indicates if ivy files should generally be validate against xsd or not. This setting is only a default value, and can be overriden : 1) in ant tasks 2) in resolvers So if there is a setting in the resolver, it always win against all other settings. checkUpToDate indicates to ivy if it must check date of artifacts before retrieving them (i.e. copying them from cache to another place in your filesystem). Usually it is a good thing to check date to avoid unnecessary copy, even if it's most of the time a local copy. cacheIvyPattern and cacheArtifactPattern are used to configure the way ivy stores ivy files and artifacts in the cache. Usually you do not have to change this, unless you want to use the cache directly from another tool, which is not recommended. Attributes
typedefTag: typedefDefines a new type in ivy. Useful to define new dependency resolvers, in particular, but also latest strategies. See how to write and plug your own dependency resolver for details. Attributes
Latest StrategiesTag: latest-strategiesDefines a list of latest strategies usable in ivy. Each latest strategy is identified by its name, given as an attribute. The child tag used for the latest strategy must be equal to a name of a latest strategy type (usually added with the typedef tag). The latest strategies which are always included in ivy (and do not require anything in the configuration file) are: - latest-time: compares the revisions date to know which is the latest. While this is often a good strategy in terms of pertinence, it has the drawback to be costful to compute with distant repositories. If you use ivyrep, for example, ivy has to ask the http server what is the date of each ivy file before knowing which is the latest. - latest-revision: compares the revisions as string, using an algorithm close to the one used in the php version_compare function. This algorithm takes into account special meaning of some text. For instance, with this strategy, 1.0-dev1 is considered before 1.0-alpha1, which in turn is before 1.0-rc1, which is before 1.0, which is before 1.0.1. - latest-lexico: compares the revisions as string, using lexicographic order (the one used by java string comparison). Child elements
Dependency ResolversTag: resolversDefines a list of dependency resolvers usable in ivy. Each dependency resolver is identified by its name, given as an attribute. The child tag used for the dependency resolver must be equal to a name of a dependency resolver type (either built-in or added with the typedef tag). See buit-in dependency resolvers chapter below for details on available dependency resolvers. Child elements
Conflict ManagersTag: conflict-managersDefines a list of conflicts managers usable in ivy. Each conflict manager is identified by its name, given as an attribute. The child tag used for the conflict manager must be equal to a name of a conflict manager type (either built-in or added with the typedef tag). Here is a list of predefined conflicts managers (which do not require anything in the configuration file): - all: this conflicts manager resolve conflicts by selecting all revisions. Also called NoConflictManager, it does evict any module. - fixed: this conflict manager always select the same revision - latest-time: this conflict manager selects only the 'latest' revision, latest being defined as the latest in time. Note that latest in time is costly to compute, so prefer latest-revision if you can. - latest-revision: this conflict manager selects only the 'latest' revision, latest being defined by a string comparison of revisions. Child elements
modulesTag: modulesDefines the rules on which resolvers should be used for which modules. The rules are given by defining a module set, using regexp for module organisation and name, and giving the name of the corresponding resolver to use. Child elements
moduleTag: moduleDefine a resolver application rule. The tag defines a module set, by giving a regexp for organisation and name (for instance, you can use .* to specify all). It also gives the name of the resolver to use for this module set. Attributes
Built-in dependency resolversFirst of all, if you think that ivy lacks THE dependency resolver you need in your development environment, you can write and plug your own. But first checks the following built-in resolvers to see if you don't find what you want here...IvyRep resolver
Note that if no ivy file is found on ivyrep, then this resolver behaves like ibiblio resolver. Thus it's always better to use this resolver instead of ibiblio one, which is provided mainly for compatibility reasons. Attributes
IBiblio resolver
Prefer the use of ivyrep resolver which adds ivy file handling to this resolver. Attributes
File System resolver
The configuration of such a resolver is mainly done through ivy and artifact patterns, indicating where ivy files and artifacts can be found in the file system. You can indicate a list of pattern which will be checked one after the other. Attributes
Child elements
Url resolver
Attributes
Child elements
Chain resolver
Attributes
Child elements
Dual resolver
Attributes
Child elements
Ivy Files topIvy filesIvy use is entirely based on what is called ivy files. Ivy files are xml files, usually called ivy.xml, containing the description of the dependencies of a module, its published artifacts and its configurations.Here is the simplest ivy file you can write: <ivy-module version="1.0"> <info organisation="myorg" module="mymodule" /> </ivy-module> Since version 0.8, ivy publishes an xslt which help make ivy files more readable. You just have to add a line like this one in your ivy file: <?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>However, all information is not presented with the xslt (dependency configurations, in particular). And due to security issues, it only works if the ivy file is in the same domain as the xsl... But they are particularly useful to browse the ivy repository. If you want to see a sample file using almost all possibilities of ivy files, check this one, with or without xslt. Before beginning the reference itself, it is required to have in mind the terminology defined in the main page of this reference documentation. For those familiar with xml schema, the schema used to validate ivy files can be found here. Hierarchical Indexivy-module info license ivyauthor repository description configurations conf publications artifact conf dependencies dependency conf mapped artifact conf include conf exclude conf conflicts manager ivy-moduleTag: ivy-moduleRoot tag of any ivy-file. Attributes
Child elements
infoTag: info Parent: ivy-moduleGives information about the module this ivy file describe Attributes
Child elements
licenseTag: license Parent: infoGives information about a license of the described module. Attributes
Ivy AuthorTag: ivyauthor Parent: infoGives information about who has contributed to write this ivy file. It does NOT indicate who is the author of the module itself. Attributes
Public RepositoryTag: repository Parent: infoGives information about a public repository where the module can be found. This information is given as an indication, repositories being able to be down over time. Attributes
DescriptionTag: description Parent: infoDescribes the current module. This tag is the only one which can contain free text, including html. It is used to describe the module itself, usually in a single short phrase (it is not meant to replace the module description on the corresponding web site), and then gives all information necessary to use the module, especially information about public configurations, how and when to use them. Attributes
configurationsTag: configurations Parent: ivy-moduleContainer for configuration element. If this container is not present, it is assumed that the module has one public configuration called 'default'. Child elements
configuration declarationTag: conf Parent: configurationsDeclares a configuration of this module. As described in the reference page, a configuration is a way to use or construct a module. Some modules may be used in different ways (think about hibernate which can be used inside or outside an application server), and this way may alter the artifacts you need (in the case of hibernate, jta.jar is needed only if it is used outside an application server). Moreover, a module may need some other modules and artifacts only at build time, and some others at runtime. All those differents ways to use or build a module are called in ivy configurations. The conf element in the configurations section declares one configuration. This declaration gives the name of the configuration declared, its visibility and the other configurations of the module it extends. Visibility is used to indicate whether or not a configuration can be used from other modules depending on this one. Thus a private configuration is only used for internal purpose (maybe at build time), and other modules cannot declare to depend on it. A configuration can also extend one or several other ones of the same module. When a configuration extends another one, then all artifacts required in the extended configuration will also be required in the configuration that extends the other one. For instance, if configuration B extends configuration A, and if artifacts art1 and art2 are required in configuration A, then they will be automatically required in configuration B. On the other hand, artifacts required in configuration B are not necessarily required in configuration A. This notion is very helpful to define configurations which are similar with some differences. Attributes
publicationsTag: publications Parent: ivy-moduleContainer for artifact elements, used to describe the artifacts published by this module. If this container is not present, it is assumed that the module has one artifact, with the same name as the module, and published in all module configurations. Thus if you have a module which publishes no artifacts (a sort of virtual module, made only to integrate several other modules as a whole), you have to include a publications element with no artifact sub element. Child elements
published artifactTag: artifact Parent: publicationsDeclares an artifact published by this module. This is especially useful for other modules dependending on this one. They thus get all published artifacts belonging to the configurations asked. Indeed, each published artifact declares in which public configuration it is published. Thus a module depending on this module only get artifacts marked with the asked configurations, taking into account configurations extension (see configuration declaration). The configurations in which an artifact is published can be configured in two ways: - conf attribute on artifact element - conf subelement The twos are equivalent, it is only a matter of preference. However, do not mix both for one artifact. Attributes
Child elements
artifact configurationTag: conf Parent: artifactIndicates a public configuration in which enclosing artifact is published. Attributes
dependenciesTag: dependencies Parent: ivy-moduleContainer for dependency elements, used to describe the dependencies of this module. If this container is not present, it is assumed that the module has no dependency at all. Child elements
dependencyTag: dependency Parent: dependenciesDeclares a dependency for this module. A dependency is described by the module on which the current module depends (identified by its name, organisation and revision), and a mapping of configurations. The revision can be given as a fixed one (1.5.2, for instance) or as a latest one. Two possibilities are offered for the moment: - latest.integration, which selects the latest revision of the dependency module. - end the revision with a +, which selects the latest sub-revision of the dependency module. For instance, if the dependency module exists in revision 1.0.3, 1.0.7 and 1.1.2, "1.0+" will select 1.0.7. The way to determine which revision is the "latest" between two is configurable through the use of pluggable LatestStrategy. See ivy main concepts for details about this. This mapping indicates which configurations of the dependency are required in which configurations of the current module, also called master configurations. There are several ways to declare this mapping of configurations, choose depending more on preference than on possibilities. Try to not mix usage in a single dependency element: do not use both nested and inline mapping declaration. The first way to declare this mapping is called the inline mapping. It is maybe the less natural at first, but it's powerful and concise. Inline mapping can take several forms. - Specify one configuration name. This means that in this master configuration the same dependency configuration is needed. For instance, if the current module has defined a configuration named 'runtime', and the dependency too, then having an inline mapping configuration set to 'runtime' means that in the runtime master configuration the runtime dependency configuration is required. - Specify a configuration mapping using the '->' operator separating a comma separated list of master configurations (left operand) of a comma separated list of dependency configurations (right operand). In this case, all specified dependency configurations are required in all specified master configurations. For instance, 'A, B, C -> E, F' means that dependency configurations E & F are required in master configurations A, B and C. Note that you can use the wildcard '*' as a configuration name, meaning that all configurations (either master or dependency public ones depending on the side) are wanted. For instance, '* -> B, C' means that B & C dependency configurations are required in all master configurations - Specify a semi-column separated list of any of the previous specs. In this case, it is the union of the mapping which is kept. For instance, 'A -> B; * -> C' means that B conf is needed in A conf and C conf is need in all master conf... so both B & C dep conf are required in A master conf If you prefer more verbose mapping declaration, everything is also possible with sub elements mapping declaration. Moreover, the dependency element also supports an artifact restriction feature (since 0.6). See dependency artifact restriction for details. Finally, the dependency element also supports an a force attribute (since 0.8), which gives an indication to conflicts manager to force the revision of a dependency to the one given here. See conflicts manager for details. Attributes
Child elements
master to dependency configuration mappingTag: conf Parent: dependencyDescribes a configuration mapping for a dependency. See also the inline configuration mapping in dependency element. Attributes
Child elements
mapped dependency configurationTag: mapped Parent: confDescribes a mapped dependency configuration for a master configuration. Attributes
dependency artifact includeTag: artifact Parent: dependencyTag: include Parent: dependency This feature gives you more control on a dependency for which you do not control its ivy file. It enables two things: - restrict the artifacts required by including only the artifacts given here, even if configuration does not a good separation of published artifacts - specify the artifacts required, if the dependency has no ivy file. Indeed, when a module has no ivy file, it is assumed that it publishes exactly one artifact having the same name as the module itself. But when this module publishes more artifacts, or simply does not respect the name rule, and if you cannot deliver an ivy file for it (because you do not control the repository, for instance - think about maven ibiblio repository, to give no name), then this feature let you specify the artifacts names you want to retrieve. This feature is handled by two tags, artifact and include, which are stricly equivalent. However, it is a good practive to use the artifact tag to specify the artifact required, and the include tag to specify artifact inclusion among dependency published ones. Each artifact restriction can be given in the context of particular master configurations. By default, if no configuration is specified, artifacts restriction apply to all master configurations. But you can specify that a restriction applies only to one or several master configurations, using either inline or nested conf specification. In this case, do not forget that if you do not specify any restriction for a particular configuration, then no restriction will apply for this configuration and it will be resolved not taking into account any restriction. For instance, imagine you have A, B & C master configurations. If you restrict to art1 in A & B and art2 in A, then C will not be restricted at all, and will thus get all artifacts of all dependency configurations if you do not specify a configuration mapping. To prevent this, you have to specify a configuration mapping for the dependency, mapping only A & B to some or all dependency configurations. Example: <dependency org="yourorg" name="yourmodule9" rev="9.1" conf="A,B->default"> <artifact name="art1" type="jar" conf="A,B"/> <artifact name="art2" type="jar" conf="A"/> </dependency> Attributes
Child elements
dependency artifact include configurationTag: conf Parent: artifactSpecify a configuration in which the enclosing artifact inclusion should be included. Attributes
dependency artifact excludeTag: exclude Parent: dependencyThis feature gives you more control on a dependency for which you do not control its ivy file. It enables to restrict the artifacts required, by excluding artifacts being published by the dependency, even if configuration does not a good separation of published artifacts The same principle concerning configuration as for include applies to this exclude feature (see above the include feature). Note that exclusion is always done AFTER inclusion has been done. Attributes
Child elements
dependency artifact exclude configurationTag: conf Parent: artifactSpecify a configuration in which the enclosing artifact exclusion should be included. Attributes
Conflicts ManagerTag: conflicts Parent: ivy-moduleContainer for conflict manager elements, used to indicate how conflicts should be resolved for this module. A conflict occurs when two revisions of the same module are required. This can happen in several cases, but the more often it is due to transitive dependencies: a module depends on A rev 1.0 and on B rev 2.0, and B depends on A rev 1.1. Then we say there is a conflict on A. To resolve the conflict, ivy uses conflicts managers. A conflict manager is able to select, among a list of module revisions in conflict, a list of revisions to keep. Yes, it can selects a list of revision, even if most conflicts manager select only one revision. But in some cases you will need to keep several revisions, and load in separate class loaders, for example. Conflicts manager can be defined in each ivy file. Conflicts are thus resolved recursively, each module being responsible to resolve conflicts of its dependencies. Conflicts manager are declared by module, this means that you can declare a different conflict manager for each dependency. Moreover, conflicts manager being in a separate section in the ivy file (and not in the dependencies section), you can declare them for a set of modules (using regular expression, see manager), and you can declare them for non direct dependencies. Imagine a module depends on A and B, A depends on C rev 1.0 and B depends on C rev 2.0. Then there is conflict on C which must be solved by the module, even if the module has no direct dependency on C. This is possible with the conflict manager handling of ivy. Ivy comes with 4 built-in conflicts manager, but you can also plug your own: - all: this conflicts manager resolve conflicts by selecting all revisions. Also called NoConflictManager, it does evict any module. - fixed: this conflict manager always select the same revision - latest-time: this conflict manager selects only the 'latest' revision, latest being defined as the latest in time. Note that latest in time is costly to compute, so prefer latest-revision if you can. - latest-revision: this conflict manager selects only the 'latest' revision, latest being defined by a string comparison of revisions as defined by the latest-revision strategy (see Latest Strategies for details). The two "latest" conflicts manager also take into account the force attribute of the dependencies. Indeed direct dependencies can declare a force attribute (see dependency), which indicates the the revision given in the direct dependency should be prefered over indirect dependencies. Conflicts manager are used during the resolve operation, i.e. when ivy analyse the graph of dependencies and download corresponding ivy files and artifacts. The fact to manage conflict at resolve time enables to minimize downloads: when a module is evicted by a conflict manager, it is not downloaded. There are two things optimized during conflict resolution: download of artifacts and download of ivy files. The first is always ensured by ivy, i.e. artifacts of a module evicted will never be downloaded. The second is not as simple to handle because to know what are the conflicts ivy needs to know the dependency graph, and to know the dependency graph, it has to download ivy files. But ivy is highly optimized on this too, and it tries to evict modules as soon as possible. That's why the order of dependencies is important for download optimization. Indeed ivy traverses the dependency graph in the order in which dependencies are declared in the ivy files, and each time it encounters a dependency on a module, it first check if there is a conflict on this module, and if this is the case, it asks the conflict manager to resolve the conflict. Then if the module is evicted, it does not download its ivy file, and the whole branch is not traversed, which can saves a lot of time. If this container is not present, a default conflict manager is used for all modules. The current default conflict manager is the "latest-revision" conflict manager. Child elements
Conflict ManagerTag: manager Parent: conflictsSpecify a a conflict manager for one or several dependencies. The way to specify a conflict manager is by giving indication to which dependencies the conflict manager applies (by giving organisation and module names or name regexp), and then specifying the conflict manager, either by giving its name or by specifying a fixed revision list, in which case a fixed conflicts manager is used. See Conflicts Manager for details on conflicts manager in general. Attributes
Using ivy topUsing IvyThe main and most frequent way to use ivy is from an ant build file. However, ivy can also be called as a standalone application.If you use ant version 1.6.0 or superior, you just have to add ivy namespace to your project (xmlns:ivy="antlib:fr.jayasoft.ivy.ant" attribute of your project tag), and you can call ivy tasks. If you use ant 1.5.1 or superior, you have to define the tasks in your build file: <taskdef name="ivy-configure" classname="fr.jayasoft.ivy.ant.IvyConfigure"/> <taskdef name="ivy-resolve" classname="fr.jayasoft.ivy.ant.IvyResolve"/> <taskdef name="ivy-retrieve" classname="fr.jayasoft.ivy.ant.IvyRetrieve"/> <taskdef name="ivy-deliver" classname="fr.jayasoft.ivy.ant.IvyDeliver"/> <taskdef name="ivy-publish" classname="fr.jayasoft.ivy.ant.IvyPublish"/>Then you can use the tasks, but check their name, following samples assume you use the ivy namespace (ivy:xxx tasks), whereas with ant 1.5 you cannot use namespace, and should therefore use ivy-xxx tasks if you have followed the taskdefs above. If you use an ant version lower than 1.5.1, you can not use the ivy tasks... you should then call ivy as any external program. Calling ivy as a standalone programIn the case you want to call ivy as a standalone program (outside from ant), you have to put commons-cli 1.0 and its dependencies in your classpath.Then here is how to call it: java fr.jayasoft.ivy.Main -?It will indicate you what can be given as argument. Here are some examples: java fr.jayasoft.ivy.Maincalls ivy with default configuration using ivy.xml in the current dir java fr.jayasoft.ivy.Main -conffile path/to/myivyconf.xml -ivyfile path/to/myivy.xmlcalls ivy with given ivyconf file using given ivy file Calling ivy from ant: first stepsOnce your build file is ok to call ivy tasks, the simplest way to use ivy is to call the ivy retrieve task with no parameters:<ivy:retrieve />This calls ivy with default values, which might be ok in several projects. In fact, it is equivalent to: <target name="resolve">
<ivy:configure /> <ivy:resolve file="${ivy.dep.file}" conf="${ivy.configurations}" /> <ivy:retrieve pattern="${ivy.retrieve.pattern}" conf="${ivy.configurations}" /> </target> Those 3 tasks follow the 3 main steps of ivy retrieving dependencies process:
To understand more accurately the behaviour of ivy tasks, one should know that a property file is loaded in ant by ivy at the beginning of the configure call. This property file contains the following properties:
ivy.project.dir = ${basedir}
ivy.lib.dir = ${ivy.project.dir}/lib
ivy.build.artifacts.dir = ${ivy.project.dir}/build/artifacts
ivy.distrib.dir = ${ivy.project.dir}/distrib
ivy.configurations = *
ivy.resolver.default.check.modified = false
ivy.status = integration
ivy.dep.file = ivy.xml
ivy.conf.file = ivyconf.xml
ivy.retrieve.pattern = ${ivy.lib.dir}/[artifact]-[revision].[ext]
ivy.deliver.ivy.pattern = ${ivy.distrib.dir}/[type]s/[artifact]-[revision].[ext]
ivy.publish.src.artifacts.pattern = ${ivy.distrib.dir}/[type]s/[artifact]-[revision].[ext]
ivy.ivyrep.default.ivy.root = http://www.jayasoft.fr/org/ivyrep/
ivy.ivyrep.default.ivy.pattern = [organisation]/[module]/ivy-[revision].xml
ivy.ivyrep.default.artifact.root = http://www.ibiblio.org/maven/
ivy.ivyrep.default.artifact.pattern = [module]/[type]s/[artifact]-[revision].[ext]
ivy.ibiblio.default.artifact.root = http://www.ibiblio.org/maven/
ivy.ibiblio.default.artifact.pattern = [module]/[type]s/[artifact]-[revision].[ext]
ExampleHere is a more complete example of build file using ivy:<project xmlns:ivy="antlib:fr.jayasoft.ivy.ant" name="sample" default="resolve">
<target name="resolve"> <ivy:configure file="../ivyconf.xml" /> <ivy:resolve file="my-ivy.xml" conf="default, myconf" /> </target> <target name="retrieve-default" depends="resolve"> <ivy:retrieve pattern="lib/default/[artifact]-[revision].[ext]" conf="default" /> </target> <target name="retrieve-myconf" depends="resolve"> <ivy:retrieve pattern="lib/myconf/[artifact]-[revision].[ext]" conf="myconf" /> </target> <target name="retrieve-all" depends="resolve"> <ivy:retrieve pattern="lib/[conf]/[artifact]-[revision].[ext]" conf="*" /> </target> <target name="deliver" depends="retrieve-all"> <ivy:deliver deliverpattern="distrib/[artifact]-[revision].[ext]" pubrevision="1.1b4" pubdate="20050115123254" status="milestone" /> </target> <target name="publish" depends="deliver"> <ivy:publish resolver="internal" artifactspattern="distrib/[artifact]-[revision].[ext]" pubrevision="1.1b4" /> </target> </project> Tasks reference documentationconfigureThe configure task is used to configure ivy with an xml configuration file.See configuration for details about the configuration file itself. Note for developers: After the call to this task, a reference to the configured ivy instance used by all subsequent ant tasks is put in the ant project, under the id "ivy.instance".
HTTP AuthenticationNote: HTTP Authentication can be used only if commons-httpclient.jar is in your classpath If any of the url you use in ivy (especially in dependency resolvers) need http authentication, then you have to provide the host, realm, username and passwd attributes of the configure task. These settings will then be used in any further call to ivy tasks.ExamplesSimplest configuration<ivy:configure />Use either ${ivy.conf.file} if it exists, or the default configuration file Configure with a file<ivy:configure file="myconffile.xml" /> Configure with an url<ivy:configure url="http://mysite.com/myconffile.xml" /> resolveThe resolve task actually resolve dependencies described in an ivy file, and put the resolved dependencies in the ivy cache.If configure has not been called before resolve is called, a default configuration will be used (equivalent to call configure with no attributes). After the call to this task, four properties are set in ant: ivy.organisation: set to the organisation name found in the ivyfile which was used for resolve ivy.module: set to the module name found in the ivyfile which was used for resolve ivy.revision: set to the revision name found in the ivyfile which was used for resolve, or a generated revision name if no revision was specified in the file ivy.resolved.configurations: set to the comma separated list of configurations resolved Note for developers: After the call to this task, a reference to the module descriptor resolved is put in the ant project under the id "ivy.resolved.descriptor".
retrieveThe retrieve task copies resolved dependencies anywhere you want in your file system.If no resolve has been called before retrieve is called, a default resolve is called (equivalent to a call to resolve with no attributes).
deliverDelivers a resolved ivy file of the current module, and possibly do recursive delivery of dependencies.This task does two main things: - deliver a resolved ivy file of the current module, based upon the last resolve done. In the resolved ivy file, no latest version of any kind subsist, so the ivy file can be used later safely to obtain the same dependencies (providing that a revision uniquely identifies a module, which should be the case for proper ivy use). - do recursive delivery. This is done only if a deliver target is given to the deliver task. If a deliver target is set, then it is called for each dependency which has not a suffisant status compared to the deliver status set for this task. This means that if you deliver an integration revision, no recursive delivery will be done. If you deliver a milestione revision, deliver target will be called with each integration dependency. Finally, if you deliver a release revision, then deliver target will be called with each integration and milestone dependency. The deliver target is called with the following properties available: * dependency.name : the name of the dependency to recursively deliver * dependency.published.status : the status to which the dependency should be delivered * dependency.published.version : the revision to which the dependency should be delivered * dependency.version : the revision of the dependency that should be delivered (the one that was retrieved during last resolve) Note that both dependency.published.status and dependency.published.version are in fact asked to the user via standard ant input. the delivered ivy file will update its dependency revisions with those given here.
publishPublishes the current modules artifacts.This task is meant to publish the declared published artifacts of the current module to a repository. The repository is given through the name of a resolver declared in current ivy configuration. See configuration for details about resolver supporting artifact publishing. It also publishes the delivered ivy file (except if you don't want), and even deliver it if it has not been done with a previous deliver call. That's why this task takes some parameters useful only for delivery.
cachepathConstructs an ant path consisting of artifacts in ivy cache for a configuration.This task is usually used after a resolve, and can be used instead of retrieve. Note that this task does not rely on retrieve, because built path is made of artifacts direcly in ivy cache. Please prefer the use of retrieve + standard ant path creation, which make your build more independent from ivy (once artifacts are properly retrieved, ivy is not required any more). Built path is registered in ant with a given id, and can thus be used like any other ant path using refid.
reportGenerates reports of dependecy resolving. One report per configuration is generated, but all reports generated together are hyperlinked one to each other.This task should be used only after a call to resolve, even if the call was not done during the same ant build. In fact, this task uses xml report generated by resolve in cache. So if you call resolve on a module for a given configuration, you can call report safely on this module and this configuration as long as you do not clean your ivy cache. If you want to have an idea of what reports look like, check this very simple example. The task also generates a graphml file which can be loaded with the free yEd graph editor. Then following a few simple steps you can obtain a graph like this one.
varSets a variable (by name and value), or set of variables (from file or url) in ivy.Variables are case sensitive. Contrary to ant properties, ivy variables are mutable. But a problem with this is that you do not control when variables are substituted, and usually it is done as soon as possible. So changing the value of a variable will have no effect if it has already been substituted. Consequently, using this task is NOT recommended. See reference page for details about ivy variables.
Products Comparison topProducts comparison - last updated 2005-04-21We are frequently asked how Ivy can be compared to other dependency management tools. Here is a short matrix summing up a comparison of the products handling dependency management that we have heard about.Obviously, this comparison can not be objective and may be inacurrate for some products, but we have tried to do it with as little subjective judgement as possible.
Some ExplanationsMaven ibiblio compatiblityThe use of the maven ibiblio repository is interesting because it is already filled with many projects. Benefiting from this repository is thus a plus.On this feature, the best is obviously maven itself, since this repository has been built at the initiative of the project. Maven2 is a bit special, because it changes the layout of the repository compared to maven1, and thus a new repository is available. But everything in the first repository seems to be synced in the second, and how could we say that maven is not 100% compatible with maven repository ;-). The dependencies task of http-unit is also very good, one of the main aim of the project being to bring this repository to ant users. Savant does not provide such a compatibility. Ivy, since its version 0.6, can be considered almost as good as the dependencies task. It provides a built-in ibiblio repository compatibility, and the limitation of not being able to say that you depend on a particular jar of a module has been deleted by the 0.6+ feature of artifacts restriction. For sure, the use of ivy files for dependencies is still heavily recommended, the advantage of this technique being that once an ivy file has been written, you can reuse the module easier, and it's the aim of Ivy. Ant integrationAnt is the most used build tool in the java community. Being well integrated with it is a real plus.On this feature, maven, which is also a build tool by its own and not only a dependency management tool, is the only one to distinguish itself (even if you can call ant tasks from maven, the opposite is not easily the case). Maven2 will propose ant tasks for its dependency management feature, so a good step is taken in this direction. But for the moment it's not publicly available. For the others, integration is at the same level. The dependencies task and Savant could be claimed to be more integrated, since the dependencies are declared in the build file itself and they produce paths or filesets of the dependencies. Ivy, for its part, has taken the party to be less intrusive in the build file: - The dependencies are described in a separate file. The advantage of being separated is that this dependency file can be reused for dependency of dependency management, and that it can have its own life in your source control management, in particular. - It lets you build your filesets and paths by your own. The advantage is that if you already have a build file, you can simply ask Ivy to put your dependencies at the place they used to be, and that's all, you have migrated to Ivy. Moreover, you can still benefit of all the power of ant filesets and paths declaration. - Since 0.8, it is able to build a path for you with the cachepath task. Continuous integrationA dependency management tool is the most util when your dependencies change often, and this is especially the case in a continuous integration environment, where your dependencies can change of version very often.On this point, as far as I know, Savant do not allow to automatically change the version you use when a new is released. Maven provides a SNAPSHOT feature, which enables continuous integration only if the component you depend on publishes SNAPSHOT versions. And you can by no way know which was really that version, in order to get that particular version on a later time. I have for the moment very few information on Maven2 on this subject, but it will at least do what maven did. The dependencies task say you can tell that you depend on the latest version, and that it is then the responsibility of the Repository to get it... but I haven't found more information on their web site. Maybe it uses the same principle as Maven... Ivy uses pluggable latest strategies to find the latest version, so that the component you depend on has nothing special to do. Moreover, it produces a report in which it tells which version has been retrieved, so that you can easily know the environment of the component you are building. Finally, it can even produce an ivy file with all latest revisions resolved to a fixed one, so that you can use it to reproduce the same environment even later, when new versions of the dependencies will have been built. Transitive dependenciesTransitive dependencies management, also known as dependencies of dependencies management, let you reuse more easily complex components which have themselves dependencies, and help you manage conflicts between dependencies.Maven and the dependencies task does not provide this feature at all. Maven2 will provide this feature, but few doc is avaialble for the moment. It seems that it will be handled by declaring a dependency on the pom of another project. I have no information on how filter will be applied to the transitive dependencies. Savant actually manage transitive dependencies, but you automatically get all dependencies of your dependencies, not being able to filter them easily. Ivy provides this feature, and, with its concept of configurations, let you choose the set of artifacts of your dependencies you really need. You can even use fine graine filters (include/exclude) to adjust what you want. Finally, its unique configurable conflict manager let you manage conflicts the way you want, even if the default strategy works in most cases so that no special configuration is required. FlexibilityIs the dependency management tool able to adapt to your environment, or have you to follow its rules ? It's a matter of flexibility, and it's hard to evaluate.As far as I know, Maven dependency management is based on a rigid structure of repository you have to follow, unless you specify for each jar where it can be found, which does not really let you have a repository structure of your choice. Maven2 will certainly follow the same philosophy. The dependencies task has the same limitation, unless you create your own implementation of Repository. Savant seems to provide a lot of flexibility, but it also seems quite hard to configure. Ivy is extremely flexible: - comes out of the box with two main ways to find dependencies (filesystem based and url based) - let you configure your repository layout with very simple to define patterns - let you use multiple repositories, chaining them or defining which repository to use for which modules or group of modules - let you choose where you artifacts are copied in your file system, with or without version in the name, and structured the way you want, all with the same simple pattern principle - let you define reusable configurations of your component, since a same component does not have the dependencies at build time or runtime, or when deployed in a server or as a standalone application, etc. MaturityOn this point, two products are now quite old and can be considered mature: Maven and Savant. On the other hand, the dependencies task has published its first version (0.1) on september 2004, and, at the time of this writing, no version has been published since their 0.4 in december 2004.Maven2 is still in alpha, with no public download and very few documentation. Finally, Ivy as published its first public version (0.5) on january 2005 after several months of use in our company. After several months of user driven development and testing, and after several weeks of release candidates cycles, it is finally close to its first stable release: 1.0. It's still far from being "mature", but backward compatibilty will be assured with future versions, and the user communitity grows from day to day. And if you want to have a look of what others think of Ivy, check the links section. Feel free to comment the comparison on this page if you think that we have forgotten some points or missed features of the other products. FAQ topFrequently Asked QuestionsI have a problem with ivy, how can I get more information about what it is doing ?The first thing to do for trouble shooting ivy is to increase your ant message level. Use -verbose to have verbose messages, and -debug or -d to have debug messages.Ivy seems to fail connecting to ibiblio...First, check if the ibiblio site is ok with your favorite browser. If the site is ok, maybe it's a problem of proxy configuration. Set your ANT_OPTS environment variable to configure your proxy if you have one. For instance:set ANT_OPTS=-Dhttp.proxyHost=monproxy -Dhttp.proxyPort=3128If it still doesn't work, maybe it's your dependency file which is not ok. Check if the module name you depend on is actually a name of directory under www.ibiblio.org/maven/. If this is the case, check if the jar with a name like [module]-[revision].jar is present under the jars directory of this module on ibiblio. For instance: www.ibiblio.org/maven/commons-httpclient/jars/commons-httpclient-2.0.jar If this is the case, check your ivy configuration to see if you actually use the ibiblio resolver. Finally, you can check if the files were not downloaded but corrupted (Ivy has no md5 checking for the moment) by checking your lib directory and opening the jars if any with an unzip program. If you still have problems post on the forum mentioning your OS, your version of ant, your version of ivy, your configuration file and your ivy file. Ivy beginners questionsWhat if I do not want to put my library files in the lib directory ?No problem, you just have to set an ant property:<property name="ivy.lib.dir" value="pathtomylibdir"/> What if I do not want the revision of the files I retrieve to appear in the file name ?A typical question for people using an IDE like eclipse and often changing dependency revision: it's a bit boring to change your IDE project just to tell him to use comp-build2596.jar instead of comp-build2595.jar, when you have already changed your ivy file (and even if you haven't changed it, if you use the continuous integration feature !). No problem, you have a total control on the files retrieved using the pattern attribute in the retrieve task:Here is the default pattern:
<ivy:retrieve pattern="${ivy.lib.dir}/[artifact]-[revision].[type]"/>
And here is one which do not suffix file name with dependency revision:
<ivy:retrieve pattern="${ivy.lib.dir}/[artifact].[type]"/>
And one which makes your lib directory seem like the ibiblio repository:
<ivy:retrieve pattern="${ivy.lib.dir}/[module]/[type]s/[artifact]-[revision].[type]"/>
Not too difficult, and really flexible, isn't it ? And check the retrieve task
reference documentation to learn more about it...
What if I do not find the component I depend on in the maven ibiblio repository, or if i cannot access it ?The maven ibiblio repository is interesting to use because it exists, but it have some limitations, which might make you consider using a different repository for retrieving your dependencies.No problem, ivy proposes other way to resolve your dependencies. For the moment, here are the possibilities:
Services topDevelopment Environment Consulting and ServicesAs the author of Ivy, our company is able to propose its expertise in the development environment field.Do you have troubles to manage the dependencies of your projects ? Do you often face problems when you have to deliver a product ? Did you ever spent hours, or even days, to align the dependencies of all of your components ? Did you ever faced a last minute bug due to a tardive integration of your components ? A good development environment can help you solves these problems, have a better and cleaner delivery process, and make your developer happier ! You can find a resume about some problematics of development environment and the services we provide on this presentation. Development Environment ConsultingThe cheapest service is a remote review of your development environment, with a lot of advices and code examples (sample ant build files, sample ivy files) to make it cleaner and more effective.Usually 1 to 2 days only are necessary. Development Environment Booster KitWe offer an in-house set up of a better development environment, reviewing your existing environment and setting up a better one with ant, ivy, enterprise repository with simple publishing process, and the ability for developers to use their own workspace components instead of enterprise one during development.At the end of this setup, a fully working development environment will be ready to use in your company. You will still have to migrate your projects to this new environment, following some simple steps. Usually only 1 to 3 days in your offices are necessary. Turnkey OptionYou do not want to bother with the integration of your build files and process with the new fully working development environment ? You can ask us to migrate all your build stuff to the new environment, so that you just have to enjoy the power of clean dependency management and delivery process !This option usually takes from 1 to 10 days, depending on the complexity of your existing builds and on the number of projects / components you use. Continuous Integration OptionHave you ever heard of all the benefits of continuous integration ?If you don't, have a look to Martin Fowler article on the subject. It may give you a good idea of why we strongly recommend setting up continuous integration for your projects. With this option, we setup a fully working continuous integration environment (based upon cruise control and ivy), which takes the dependencies between your projects into account to know what should be built. With our setup, you can easily go back to any integration build, and promote it to a delivery if you want ! Moreover, this option usually takes only from 1 to 3 days. Contact usDo any of these services interest you ? Have you another idea for which we could help ?Feel free to contact us: sales@jayasoft.org Links topLinksThey talk about IvyDecision to use Ivy is a no-brainer Cool Dependency Managment in Projects/Builds Using Ivy in AppFuse maven:uninstall Ivy is everything Maven should have/could have been 2.5 years ago Ivy Rocks! Ant vs Maven and dependency management how to manage dependencies in Ant Dependency Management with Ant using Ivy Maven vs Ant Reloaded Ant Dependency Resolver Ivy, Dependency Manager RE: Ivy is everything Maven should be Ivy in the newsEntry in freshmeat.net |