4 Replies Last post: Sep 10, 2010 2:37 PM by Marina Grechko  
Tycho Lamerigts Newbie 1 posts since
Jan 14, 2010
Currently Being Moderated

Jan 14, 2010 4:18 PM

How can I use maven build number as TeamCity build number?

When I set up a default Maven2 project from POM, TeamCity is supposed to use the Maven build number as its own build number (I think). However, this does not work for me, TeamCity simply uses it's own number (1, 2, 3, etc). My POMs have SNAPSHOT version. I would like TeamCity to use the sequence number that Maven attaches a SNAPSHOT artifact (e.g. the number 3 from the following artifact: agents-api-38.0.0-20100112.042101-3.pom). How do I configure this in TeamCity?

Jemo  Newbie 1 posts since
Jan 15, 2010
Currently Being Moderated
Jan 15, 2010 10:40 AM in response to: Tycho Lamerigts
Re: How can I use maven build number as TeamCity build number?

On the page http://www.jetbrains.com/teamcity/features/maven.html it says: "By default, it also keeps TeamCity build number in sync with the Maven version number, although you can disable this synchronization later on".

 

So apparently this synchronization of maven numbers and teamcity numbers is enabled by default, but I do not see it happening. Where/how can it be configured?

Sergey Anchipolevsky JetBrains 259 posts since
Jan 22, 2008
Currently Being Moderated
Jan 15, 2010 3:24 PM in response to: Tycho Lamerigts
Re: How can I use maven build number as TeamCity build number?

You should include variable maven.project.version into the build number pattern. For example, with pattern %maven.project.version%.{0} your build number sequence would look like

 

38.0.0-SNAPSHOT.1

38.0.0-SNAPSHOT.2

38.0.0-SNAPSHOT.3

...

etc., where the final number is the regular TeamCity build number (which can be omitted if you wish).

 

Note, that maven.project.version is taken directly from the POM, not from deployed artifacts. If the POM has a SNAPSHOT version, maven.project.version will also have "...-SNAPSHOT" value, not "...-20100112.042101-3" which is assigned to an artifact when deploying.

paul mckenzie Newbie 5 posts since
Jun 30, 2004
Currently Being Moderated
Sep 1, 2010 6:56 PM in response to: Sergey Anchipolevsky
Re: How can I use maven build number as TeamCity build number?

I am using %maven.project.version%.{0}  as the pattern and it works nicely.

 

I am trying to capture the value in a property file using a <resource> block and filtering.

 

The property file looks like:

 

 

build.number=${build.number}

 

However, after the build the property file looks like:

 

build.number=%maven.project.version%.106 
 
 
 

 

Where 106 is the correct {0} part of the build number.

 

The build number is correctly displayed on the projects tab at the end of the build.

 

The build log says:

 

Parameter 'build.number=%maven.project.version%.120' is not fully resolved, using as is.

Marina Grechko JetBrains 600 posts since
Oct 12, 2009
Currently Being Moderated
Sep 10, 2010 2:37 PM in response to: paul mckenzie
Re: How can I use maven build number as TeamCity build number?

Paul,

 

It's a known issue, please refer to http://youtrack.jetbrains.net/issue/TW-10408.

 

Kind regards,

Marina

More Like This

  • Retrieving data ...