2

I recently updated my project structure to use IVY:Extends functionality where I declared a parent (common-ivy.xml) and extend that in all the projects (I have around 120 projects using this). I achieve that by using the technique in this thread IVY Extends via ivy:resolve .

Now the problem is that after adopting to this structure I have lost the dependency between the projects which is essential and its now breaking everything. For example see below;

common-ivy.xml

<?xml-stylesheet type="text/xsl" href="http://repository.temenosgroup.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info organisation="xyz" branch="15" module="CommonDependency" revision="1.0.0" />
    <configurations defaultconfmapping="test->test(*);compile->compile(*)">
        <conf name="test" description="Test Time dependencies"/>
        <conf name="compile" description="Compile Time dependencies"/>
    </configurations>
    <dependencies>
        <dependency org="junit" name="junit" rev="4.8.2" conf="compile,test"/>
    </dependencies>
</ivy-module>

ProjectZ ivy.xml extends common but does not define any additional dependency

<?xml-stylesheet type="text/xsl" href="http://repository.temenosgroup.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info module="ProjectZ" >
        <extends extendType="all"
                 organisation="xyz"
                 module="CommonDependency"
                 revision="1.0.0"
                 location="../parent/common-ivy.xml" />
    </info>
    <dependencies />
</ivy-module>

ProjectA ivy.xml extends common as well as define its dependency on ProjectZ

<?xml-stylesheet type="text/xsl" href="http://repository.temenosgroup.com/xsl/version-doc.xsl"?>
<ivy-module version="2.0" xmlns:e="http://ant.apache.org/ivy/extra">
    <info module="ProjectA" >
        <extends extendType="all"
                 organisation="xyz"
                 module="CommonDependency"
                 revision="1.0.0"
                 location="../parent/common-ivy.xml" />
    </info>
    <dependencies>
        <dependency org="xyz" name="ProjectZ" branch="15" rev="latest-dev" conf="compile,test"/>
    </dependencies>
</ivy-module>

When I am passing this list to ivy:buildlist its returning following order;

ProjectA, ProjectZ 

which is INCORRECT it should have returned;

ProjectZ, ProjectA

I am using IVY 2.3.0. Is it a bug in IVY or am I missing something?

Community
  • 1
  • 1
SJunejo
  • 1,316
  • 4
  • 23
  • 39
  • Shouldn't your extends declaration include branch="15" to properly reference the common-ivy.xml ? – Patrice M. Sep 12 '14 at 00:48
  • 1
    extends does not support `branch` attribute it would be used directly from common-ivy.xml in each project. The problem is in Dependencies where ProjectA declares its dependency on ProjectZ but IVY is not able to recognize it – SJunejo Sep 12 '14 at 19:11

1 Answers1

1

OK I had to debug the IVY :( to resolve this issue and found out that the rev of the dependency along with the common-ivy.xml was causing the problem. While debugging I found two solutions;

1) Use rev="+" in dependency definition and let IVY resolve whatever is available

2) Remove revision="1.0.0" from common-ivy.xml as it is inherited because of extends and hence IVY fails to match latest-dev==1.0.0, once removed from common-ivy.xml my project becomes working@HostName which is correctly resolved by IVY

I chose option 2 as it requires changes in a single file and attribute is not in use in my work space anyway.

SJunejo
  • 1,316
  • 4
  • 23
  • 39