Tutorial :Sharing ivy configurations



Question:

I'm maintaining multiple projects backed by ivy configurations. Many configurations overlap, such as:

  • common build configurations ( pmd, findbugs );
  • dependency groups ( spring );

Is there a way to import these dependencies by referencing a shared configuration?


N.B. Please don't suggest Maven, as I know about it, but it is not (yet) an option for these particular projects.


Solution:1

Does include do what you need, or is the problem more complicated?

From the documentation:

<ivy-module version="1.0">    <info organisation="myorg"           module="mymodule"/>    <configurations>      <include file="path/to/included-configurations.xml"/>      <conf name="conf3"/>    </configurations>    <dependencies>      <dependency name="mymodule1" rev="1.0"/>      <dependency name="mymodule2" rev="2.0" conf="conf2,conf3->*"/>    </dependencies>  </ivy-module>  

with included-configurations.xml like this:

<configurations defaultconfmapping="*->@">    <conf name="conf1" visibility="public"/>    <conf name="conf2" visibility="private"/>  </configurations>  

Update: For dependencies, I'm not sure it is possible. I found a discussion on importing dependencies that indicates this is by design to avoid circular dependencies.

Perhaps you could write a script to process a referenced ivy file and inline the dependencies into your project?


Solution:2

Reading your question, I would solve the problem by using svn:externals (if you're using Subversion) and not Ivy.

You place all your common configurations into a config Subversion project and simply use svn:externals to import it into other projects.

As example, you can take a look at my config project on Google Code:


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »