tags:

views:

230

answers:

2

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.

+1  A: 

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?

Rich Seller
Thanks for the answer. I'd like to have the dependencies included as well, for instance import a 'findbugs' configuration and them all the dependencies are pulled in.
Robert Munteanu
Sorry my Ivy powers are weak. I've added an update showing what I've found on dependency processing.
Rich Seller
A: 

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:

Vladimir