Jenkins: How to change JENKINS_HOME on Windows
If you install Jenkins using MSI installer, it copies files to C:\Program Files (x86)\jenkins
and uses the install directory as JENKINS_HOME
(on 64bit machine).
This means that Jenkins stores all data (including plugins, workspace and job data) to C:\Program Files (x86)\jenkins
. On windows, it is recommended that application data is stored to ProgramData
and AppData
. So, I wanted to change JENKINS_HOME
.
First, I added JENKINS_HOME
to environment value, but it doen't make any sense. Jenkins prefers the value set on jenkins.xml
when we use MSI installer.
Now, let's change JENKINS_HOME
to C:\ProgramData\Jenkins
(Jenkins version: 1.550).
Stop Jenkins service.
Open
jenkins.xml
in the install folder, and edit<env name="JENKINS_HOME" value="%BASE%"/>
as follows:
<env name="JENKINS_HOME" value="%ProgramData%\Jenkins"/>
Move all files in install folder except for the following files (Don't copy because it brokes symbolic links in
jobs
folder):jre
folderjenkins.err.log
jenkins.exe
jenkins.exe.config
jenkins.out.log
jenkins.war
jenkins.war.bak
jenkins.war.tmp
jenkins.wrapper.log
jenkins.xml
Start Jenkins service.
Open
http://localhost:8080/systemInfo
and checkJEKNINS_HOME
has been changed.
Enjoy!