views:

56

answers:

2

For continuous integration I am using Maven 2 and TeamCity 5.1.2. My builder number is defined by the pattern %maven.project.version%.{0}, and this is exported to Maven build script as ${build.number}

When the build creates the jar file I would like the jar to contain a property file with this information inside:

build.number=#1.1-SNAPSHOT.106

This is so that the build number is available for display etc at runtime.

+3  A: 

You could have a copy of the property file with a placeholder for the build number

build.number=${build.number}

Than copy with filtering enabled.

sblundy
A: 

Based upon the comment, it sounds like %maven.project.version% is not being replaced by TeamCity. You're getting the build job number, but not getting the value for the maven ID.

I would look at potentially doing this in two parts.

Can ${build.number} only contain the actual build number, instead of %maven.project.version%?

If so, you should be able to have your properties file say:

build.number=#${project.version}.${build.number}

In theory that would produce:

build.number=#1.1-SNAPSHOT.106

But not having worked with TeamCity, this is just a theory.

Mike Cornell