TeamCity build number versus Ant build number task

1.3k views Asked by At

I have a build project that I run from TeamCity, now it takes the build.number from TeamCity. I want to be able to use the buildnumber task (Ant) which in my understanding when used, is supposed to change the value of build number property and increment it for next time. But it seems that I still get the build number from TeamCity.

How can I use the build number from <buildnumber file="mybuild.number"/>?

3

There are 3 answers

0
Rich Tebb On BEST ANSWER

Use the TeamCity Autoincrementer plugin to share an incrementing build number between configurations.

2
KIR On

I'm afraid so far there is no way to disable build.number property from TeamCity. The only possibility I can imagine is not to use TeamCity Ant runner and use Command-line runner instead. But in this case you'll miss many nicities of the bundled Ant runner (like immediate test reporting).

Why would you want to use buildnumber task of the Ant? To keep build number across the builds, you'd have either to commit mybuild.number to version control or to run the build always on the same agent in the same place.

1
Mark O'Connor On

The ANT buildnumber task sets the ANT property build.number.

I don't use team city, but the documentation states that it is also setting the same property.... Might explain your problem :-(

Perhaps someone knows how to switch this team city feature off.

Is there a good reason to switch? The only alternative I can offer ivy buildnumber task. It calculates the next build/release number based on what was previously published to the repository. This may not be suitable in your case. I prefer it because I don't depend on build server settings or need to keep a property file under revision control.