原文地址:http://tech.nitoyon.com/en/blog/2014/02/25/jenkins-home-win/
If you install Jenkins using MSI installer, it copies files to C:\Program Files (x86)\jenkins
and uses the install directory asJENKINS_HOME
(on 64bit machine).
This means that Jenkins stores all data (including plugins, workspace and job data) toC:\Program Files (x86)\jenkins
. On windows, it is recommended that application data is stored toProgramData
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 onjenkins.xml
when we use MSI installer.
Now, let's change JENKINS_HOME
to D:\jenkins
(Jenkins version: 1.550).
-
Stop Jenkins service (in windows servers). and then add environment system variables:
JENKINS_WORK = D:\jenkins
-
Open
jenkins.xml
in the install folder, and edit<env name="JENKINS_HOME" value="%BASE%"/>
as follows:
<env name="JENKINS_HOME" value="%
JENKINS_WORK
%"/> -
Move all files in install folder except for the following files (Don't copy because it brokes symbolic links in
jobs
folder) to new jenkins_home (D:\jenkins):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!