Jenkins 使用Tfs 插件出现 MappingConflictException 错误问题解决
FATAL: com.microsoft.tfs.core.clients.versioncontrol.exceptions.MappingConflictException: The path C:\JenkinsAgent\workspace\TestSystem is already mapped in workspace Hudson-TestSystem-XA-AT-SYSDEV;abcd. Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from XA-AT-SYSDEV/10.32.2.184:2013 at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1741) at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357) at hudson.remoting.Channel.call(Channel.java:955) at hudson.plugins.tfs.model.Server.execute(Server.java:233) at hudson.plugins.tfs.model.Workspaces.newWorkspace(Workspaces.java:109) at hudson.plugins.tfs.actions.CheckoutAction.getProject(CheckoutAction.java:144) at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:59) at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:352) at hudson.scm.SCM.checkout(SCM.java:504) at hudson.model.AbstractProject.checkout(AbstractProject.java:1208) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1810) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) com.microsoft.tfs.core.clients.versioncontrol.exceptions.MappingConflictException: The path C:\JenkinsAgent\workspace\TestSystem is already mapped in workspace Hudson-TestSystem-XA-AT-SYSDEV;GRAPECITY\Component Test. at com.microsoft.tfs.core.clients.versioncontrol.workspacecache.internal.InternalCache.checkForMappingConflicts(InternalCache.java:212) at com.microsoft.tfs.core.clients.versioncontrol.workspacecache.internal.InternalCache.checkForMappingConflicts(InternalCache.java:176) at com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.createWorkspace(VersionControlClient.java:1014) at com.microsoft.tfs.core.clients.versioncontrol.VersionControlClient.createWorkspace(VersionControlClient.java:950) at hudson.plugins.tfs.model.MockableVersionControlClient.createWorkspace(MockableVersionControlClient.java:114) at hudson.plugins.tfs.commands.NewWorkspaceCommand.call(NewWorkspaceCommand.java:81) at hudson.plugins.tfs.commands.NewWorkspaceCommand.call(NewWorkspaceCommand.java:24) at hudson.remoting.UserRequest.perform(UserRequest.java:212) at hudson.remoting.UserRequest.perform(UserRequest.java:54) at hudson.remoting.Request$2.run(Request.java:369) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:93) at java.lang.Thread.run(Unknown Source) Caused: java.lang.RuntimeException at hudson.plugins.tfs.model.Server.execute(Server.java:237) at hudson.plugins.tfs.model.Workspaces.newWorkspace(Workspaces.java:109) at hudson.plugins.tfs.actions.CheckoutAction.getProject(CheckoutAction.java:144) at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:59) at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:352) at hudson.scm.SCM.checkout(SCM.java:504) at hudson.model.AbstractProject.checkout(AbstractProject.java:1208) at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574) at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499) at hudson.model.Run.execute(Run.java:1810) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
出现这个问题的原因是 TFS 的配置文件中保存的信息和现在Jenkins 服务器上配置的信息不匹配导致的。
方案1: 修改Agent 中 Remote root directory 目录位置,修改后就可以回避错误了。
方案2:使用 vs --> Source Control Explorer --> Workspace 的下拉框中选择 Workspace 打开 Manager Workspaces.
将有问题的workspace 删除就可以了。