在 Jenkins 中拉取存储库时出现长路径错误

Long path error while pulling repository in Jenkins

我正在尝试使用 Jenkins 提取存储库,默认情况下 Jenkins 创建一个长且不可读的工作区名称。我因此收到此错误:

Caused by: com.microsoft.tfs.core.exceptions.TECoreException: The 
specified path, file name, or both are too long. The fully qualified 
file name must be less than 260 characters, and the directory name must 
be less than 248 characters.

谁能帮我解决这个问题,在配置文件中添加任何参数会有帮助吗?

轶事想法,但有两个选择:

  • 确保将回购文件 'closer' 检出到底层文件系统的根目录,以便回购可以包含更长的 filenames/paths(例如使用 C:\code 而不是像 C:\company\project\jenkins...)

  • 考虑你的 repo 中导致文件名如此长的任何东西 - 我个人在使用 NodeJS 时看到过这个并且 node_modules 文件夹在源代码管理中被跟踪,深入多个文件夹

找到解决方案,只需在jenkins.xml中添加此参数并重新启动jenkins,问题就会得到解决。

-Djenkins.branch.workspaceLocatorImpl.PATH_MAX=0