0

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?

Janusz Nowak
  • 2,595
  • 1
  • 17
  • 36
user3496599
  • 1,207
  • 2
  • 12
  • 28
  • Possible duplicate of [Dealing with "Xerces hell" in Java/Maven?](http://stackoverflow.com/questions/11677572/dealing-with-xerces-hell-in-java-maven) –  Feb 09 '16 at 07:11
  • The question is about buildnumber or changeset in tfs vc ? – Janusz Nowak Aug 07 '17 at 16:48

3 Answers3

1

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

Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22
0

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

0

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

Paul Roub
  • 36,322
  • 27
  • 84
  • 93