ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Oulds <jonat...@sbdev.net>
Subject Re: buildnumber Ant task & automated updates of ivy.xml
Date Wed, 19 Nov 2008 16:28:38 GMT
I too have been playing with this.  Currently I have an ivy file (see 
below) that is configured and delivered during the publish task.

<ivy-module version="2.0">
   <info organisation="org.example"
	module="FooBar"/>
   <publications>
     <artifact name="FooBar" type="Library" ext="lib"/>
   </publications>
   <dependencies>
     <dependency name="Foo" rev="latest.integration"/>
     <dependency name="Bar" rev="latest.integration"/>
   </dependencies>
</ivy-module>

Her is the publish task that will automatically add the correct build 
number.  ${ivy.organisation} and ${ivy.module} are both set during the 
resolve stage.

<target name="publish" depends="resolve">
   <ivy:buildnumber organisation="${ivy.organisation}"
     module="${ivy.module}"
     default="0.0.0"/>

   <ivy:publish
     artifactspattern="${dir.dist}/[artifact].[ext]"
     pubrevision="${ivy.new.revision}"
     overwrite="true"
     validate="true"
     resolver="default"/>
</target>

Mitch Gitman wrote:
> There's one Ivy Ant task that had been flying under my radar, the
> buildnumber <http://ant.apache.org/ivy/history/trunk/use/buildnumber.html>task.
> 
> It seems to me that the natural use for the *buildnumber *task is during a
> build invoked by continuous integration. A CI-invoked Ant target would go
> into an ivy.xml file and update the /ivy-module/info@revision attribute with
> the ivy.new.revision property value obtained from *buildnumber*. This could
> come into play when, under "Dealing with integration versions" on the the Ivy
> Best Practices page<http://ant.apache.org/ivy/history/trunk/bestpractices.html>,
> you take the "create automatically a new version for each" approach.
> 
> I'd be interested in hearing what other uses folks have found for the
> *buildnumber
> *task.
> 
> Also (and actually this has nothing particularly to do with *buildnumber*),
> I'd be interested in hearing what mechanisms folks are doing for doing an
> automated update of ivy.xml files. Besides the
> /ivy-module/info@revision attribute,
> there's the /ivy-module/dependencies/dependency@rev attribute, which also
> can be a good candidate for automated updates in certain situations.
> 
> I can think of two ways of automatically updating the content of an ivy.xml
> file:
> 
>    - Use regular expressions. Advantage: everything's right there in the
>    build.xml. Disadvantage: regular expressions. Yuck!
>    - Manipulate the XML programmatically, such as by binding Java objects to
>    the XML schema. This has the disadvantage of requiring Java code (and
>    possibly an additional library not already in the classpath), so you'd have
>    to create a separate Ant task or Java executable.
> 
> Or is there some other mechanism already out there in some Ant task (Ivy or
> non-Ivy) that I'm missing, like I'd missed the *buildnumber *task for a
> while?
> 


Mime
View raw message