2

While using buildnumber to calculate the new version numbers inside of an ant build script, ivy will hang for up to 20 minutes while calculating the next version. As the number of builds increases, it seems to grow exponentially (the project I'm testing with has about 600). At first I thought it might be because of large files and hash checking, but then I turned on debugging and saw this about 1,200 times:

[ivy:buildnumber] using ssh to list all in /Storage/ivy/status/base//module/version [ivy:buildnumber] SShRepository:list called: /Storage/ivy/status/base//module/version [ivy:buildnumber] found 12 urls [ivy:buildnumber] 0 matched /Storage/ivy/status/base//module/version/[artifact]-version.jar

For some reason, it is recursing through every directory to find some jar file, and when it can't find what it's looking for, it goes to the second resolver and tries again. Of course it never finds a match because there are no jars in any directory.

The ivysettings file looks like this:

<ivysettings>
        <property name="ivy.checksums" value="" />
        <property name="tisivy.host" value="builds.example.com" />
        <property name="tisivy.url.path" value="http://${tisivy.host}" />

        <property name="tisivy.file.path" value="/Storage/ivy" />
        <property name="tisivy.repo.pattern" value="[module]/[revision]" />
        <property name="tisivy.artifact.pattern" value="${tisivy.repo.pattern}/[artifact]-[revision].[ext]" />

        <settings defaultResolver="url-chain" />

        <caches/>

        <resolvers>
                <chain name="url-chain" returnFirst="true">
                        <url name="http">
                                <ivy pattern="${tisivy.url.path}/status/${tisivy.repo.pattern}/ivy.xml" />
                                <artifact pattern="${tisivy.url.path}/status/${tisivy.artifact.pattern}" />
                        </url>
                </chain>

                <ssh name="ssh" user="example" userPassword="****************" host="${tisivy.host}" publishPermissions="0644">
                        <ivy pattern="${tisivy.file.path}/status/${tisivy.repo.pattern}/ivy.xml" />
                        <artifact pattern="${tisivy.file.path}/status/${tisivy.artifact.pattern}" />
                </ssh>
        </resolvers>

        <triggers>
        </triggers>

        <statuses>
                <status name="production" integration="false" />
                <status name="integration" integration="true" />
                <status name="status" integration="false" />
        </statuses>

        <modules>
        </modules>

</ivysettings>

The call to build number looks like this: <ivy:buildnumber organisation="org" module="${ivy.module.doubleslash}" revision="${version.base}" />

I can't seem to find anyone else encountering this problem, so I'm sure somewhere I'm making a mistake.

kjones603
  • 33
  • 2
  • 4

1 Answers1

1

I normally tell the buildnumber task which resolver to use:

<ivy:buildnumber resolver="url-chain"
                 organisation="${ivy.organisation}" 
                 module="${ivy.module}" 
                 revision="${version.base}"/>

The documentation describes how the default behaviour is to search all available resolvers. (Which makes sense, the repo you publish to may not be in the default resolver setup).

Notes:

  • I use the ivy.organisation and ivy.module variables because they're set automatically from the "info" tag of my ivy file.
Mark O'Connor
  • 76,015
  • 10
  • 139
  • 185
  • I understand why it is using both resolvers. I have it set up to use http and then ssh as a fall back (They both are looking at the same repository). The question is really why it's doing a search for a .jar that I never told it to look up. If I just tell it to use http only that cuts the time in half, but it's still ridiculous for it to take 10 minutes to find the biggest number. – kjones603 Jul 15 '13 at 14:10
  • @user2576621 The ssh resolve is not included in the chain. The reason it checks both is because that is the default behaviour (as explained). As for looking for a jar you never told it to lookup... I don't understand (you're using a property "ivy.module.doubleslash" whose value is unspecified in the question). Finally, searching using HTTP protocol will always be faster, the setup cost for an SSH connection is very expensive for each module lookup. Obviously some sort of connection pooling would make this more efficient but I'd don't really understand why you're searching both repos... – Mark O'Connor Jul 15 '13 at 20:07