Jenkins: How To Build multiple projects from a TFS repository?

I have set my workspace directory to C:\jenkins_builds\workspace and I want to build ProjA and ProjB, each having a local workfolder (same as project name).

When fetching the source code from my repository, the first two things the TFS plugin does are:

  • Trigger CI Build only on changes to subfolder in VSTS (was TFS Online), using Git
  • How to retrieve Git commit id and message in VSTS/TFS build?
  • How to choose between Hudson and Jenkins?
  • How to use repo as repository on Hudson
  • How can I make Jenkins only build feature branches if they have changed when triggering from bitbucket
  • Ignoring library project with Android lint on the command line
  • tf workspace -new %workspace-name-A%;%user-name% -server:%my-server%
    
    tf workfold -map $%branch% ProjA -workspace:%workspace-name-A% -server:%my-server%
    

    Which goes fine when building ProjA. The problem is, the first command maps the root directory from the repository directly to my C:\jenkins_builds\workspace directory. The second command does what I actually want, i.e. mapping %branch% to the ProjA subfolder. Later on, when building ProjB, the first command fails (and consequently the build) with the following error message:

    The path C:\jenkins_builds\workspace is already mapped in workspace %workspace-name-A%;%user-name%.
    

    OK, it seems like a bad idea to map the root directory to the work directory. But why does this automatically happen when the TFS plugin runs the workspace new line? Currently I have to clean things up between building ProjA and ProjB by running the -unmap command.

    My team is using Team Foundation 3.0.

  • Git in TFS - Branch switching - 'Could not rmdir …'
  • Continuous integration and web deployment workflow
  • Only trigger builds on new branches in Jenkins?
  • github api to compare commits, response status is diverged
  • Jenkins GitPlugin - how to find out what failed on a pre-build merge?
  • Jenkins giving The SDK Directory doesn't exist
  • One Solution collect form web for “Jenkins: How To Build multiple projects from a TFS repository?”

    We have the same situation and there are 2 ways to solve this:

    • use different workspace-root-directories for the two builds
      This results in the need for two checkouts => double the space and slower, but better isolation between the two builds
    • “hardcode” the workspace name to the same for both builds
      By default jenkins creates a workspace containing the build name, which can be changed in the “advanced” section of the TFS config, and then you can use the same workspace-/workfolder-mapping for several builds – in our case we called them ProjectName_${NODE_NAME} so it even works on several nodes
    Git Baby is a git and github fan, let's start git clone.