Jenkins – How to set the workspace root directory on Jenkins nodes

continuous integrationJenkins

By default, jobs on a Jenkins node will be stored in [Remote FS root]\workspace\.

Currently, [Remote FS root] is set to D:\, so my jobs are in D:\workspace\. Due to the 255-characters limit on Windows, I need my job directories to be directly at the root of the drive.

How to set the workspace root directory to D:\?

Best Answer

We have to specify the following argument on startup of the Jenkins master node:

-Dhudson.model.Slave.workspaceRoot=D:/

To do so, find the jenkins.xml configuration file in $JENKINS_HOME and complete the <arguments></arguments> section.