I have a setup with a chain repository which has a repository for jar files used to build a set of war files (using a number of different permutations). I publish the jar files into one element of the chain and the war files into another. The war files are then made available via a company-wide repository.

It so happens that one of the war files has the same name as a jar file. As part of the build process for a JAR I resolve that jar in-line to get the most recent build number. However, for some reason, the resolver insists on returning the WAR file build number which happens to be wildly different from the jar file and not what I want at all.

I tried to set the type="jar" in the retrieve (as below) but it makes no difference. So then I looked a bit more closely and determined that maybe I should try a static resolve mode with a limit on the version number. But that doesn't work either! The resolve fails, and, sure enough, the next thing that happens is that the buildnumber task uses 'latest.integration'.

Is there a way of getting the buildnumber task to only consider particular artifacts? Of course, another way (apart from renaming the jar which would not be very convenient) is to create a different settings file which specifically points to the jar resolver, I suppose.

Maybe somebody has some other suggestions?

Here's an extract from my build.
   <target name="ivy-new-version" depends="configure">
<!-- asks ivy for an available version number -->

<!-- Use an in-line resolve of the jar file to see if its there. Set haltonfailure 'false' to allow the buildnumber task to happen
            when this is the first publish (ever) of this particular jar.
      -->
       <ivy:resolve
           inline="true"
           organisation="${ivy.organisation}"
           module="${ivy.module}"
           transitive="false"
           resolveMode="static"
            revision="2.0-"
           conf="jar"
           settingsref="mycompany.settings"
           haltonfailure="false"
       />

       <!-- get the build number from the resolved file
       <ivy:buildnumber
           organisation="${ivy.organisation}"
           module="${ivy.module}"
           defaultBuildNumber="1"
           default="1.0.0"
       />

<echo>Current version = ${ivy.revision}</echo>
       <echo>New revision ${ivy.new.revision}</echo>
       <echo> buildnumber = ${ivy.build.number}</echo>
   </target>

Regards

Alan Chaney

Reply via email to