kjones603
kjones603

Reputation: 33

Apache Ivy buildnumber painfully slow

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.

Upvotes: 2

Views: 744

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77951

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.

Upvotes: 1

Related Questions