• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Build Number

 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've spent the last hour on this, and I'm sure it can't be that hard. So before wasting any more time, I thought I'd ask here.

Basically, I need to create an incrementing version number in the format yyyyMMdd_nn, where nn is the build number, starting with 01 as the first build of the day. The nn part should reset each day.

Now, I have this almost working (though somewhat convoluted) as follows:

- I have a version.properties file with version.last-build-date and version.last-build-number

- I have three tasks which between them update the version.properties as required (by checking whether the date is today etc).

My problem is a bit of a chicken-and-egg situation. I need to read in version.properties to make the decision about whether the last build was today. However, I wan't to use the incremented build number in the name of a jar I'm creating later on, but because the properties file has already been read (before being updated), I can't read the new value.

I feel like I either need to reread the properties file, or find some way of doing the incrementing that doesn't require the 'propertiesFile' task, and 'entry', so that I can create the new values then use these to update the properties file and create the jar file name.

I have the feeling I'm making this more complicated that it need be.

Any ideas?

Thanks
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Second google hit - jguru discussion
 
Horatio Westock
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I had a look at this (and other google results) before posting. There are basically two solutions on that thread: write a custom task & create an external version number file.

I was hoping to do this with vanilla ant, and not have to resort to writing a task. The external version file is nice, but I need to use the new property value later in the same build script, so not really what I need.

I'm sure I'll work it out.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Ant:



Build.properties (which is an unfortunate name for Eclipse, I discovered)


[/code]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic