Using build number variable at runtime


Among other problems I am toiling with in attempting to make our build work with TeamCity is the fact that I seem to be unable to use the build number variable to create a directory at run time. I wrote an init ant target that includes creating a directory that includes the current build number.

This is what I have tried so far (with all non-pertinent code removed):
<property name="BUILD_LOGS" value="$/build-$/logs"/>

<mkdir dir="$"/>

I have also tried the following variable names for the build number:

The result is that the directory created is the literal string rather than the build number value.

Can anyone suggest a way of doing this?


Comment actions Permalink

Hi Dave

I'm currently using TeamCity to do something similar. I use the ${build.number} property passed into ant by TC to make up other properties. Here's an example taken from one of my build.xml files...

Deriving Build Information Build Version : ${build.version} Build Number : ${build.number} Build Date : ${} Build Tag : ${build.tag} ]]>

When I run the build locally, through IDEA my build number is set to 'DEV'. When it is run via TC it picks up whatever is passed in (ant properties can only be set once).

To summarise, TC definitely passes in a property named 'build.number' so I'd guess it's something in your config thats incorrect.



Comment actions Permalink


Thanks for your reply. My problem turned out to be a simple typo.



Please sign in to leave a comment.