简体   繁体   中英

How to get ${buildNumber} in TFS with Maven?

I need to add the buildNumber in my generated manifest file with Maven. We use TFS (Team Foundation Server) as our repository. Is there any way to access it?

Below link explain the how get build number with Git, SVN or Mercuria.

http://www.yegor256.com/2014/07/03/how-to-read-manifest-mf.html

I also need the same thing with TFS?

You can use ${env.TF_BUILD_BUILDNUMBER} environment variable to get TFS build number.

Please have a check on this link: https://blogs.blackmarble.co.uk/blogs/rfennell/post/2014/12/16/Setting-a-build-version-in-a-JAR-file-from-TFS-build.aspx

I think the correct variable number is env.TFS_CHANGESET or just TFS_CHANGESET. It worked for me.

Predefined variables in TFS:

  • Build.SourceVersion - Git: The commit ID.

  • BUILD_SOURCEVERSION - TFVC: the changeset.

A list of all variables here: https://www.visualstudio.com/en-us/docs/build/define/variables

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM