intellij IDEA在第一次啟動時,會在${user.home}目錄下建立以.IntelliJIdea開頭的文件夾,用來存放IDEA的配置信息、插件和緩存信息。隨着工具使用時間越多,這個文件夾會越來越大。如果用戶目錄和系統盤在一個分區,那系統盤分區可用空間就會變小,系統重裝時,這個目錄還會被刪除。
於是我們需要將此目錄修改到其他分區,修改很簡單,如下:
在IDEA安裝目錄的bin文件夾中找到idea.properties文件,我們需要里面的幾項內容:
- # Use ${idea.home} macro to specify location relative to IDE installation home.
- # Use ${xxx} where xxx is any Java property (including defined in previous lines of this file) to refer to its value.
- # Note for Windows users: please make sure you're using forward slashes (e.g. c:/idea/system).
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- #打開confi的配置
- # idea.config.path=${user.home}/config
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- #打開system的配置
- # idea.system.path=${user.home}/system
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- #打開plugins的配置
- # idea.plugins.path=${idea.config.path}/plugins
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- #打開log的配置
- # idea.log.path=${idea.system.path}/log
# Use ${idea.home} macro to specify location relative to IDE installation home. # Use ${xxx} where xxx is any Java property (including defined in previous lines of this file) to refer to its value. # Note for Windows users: please make sure you're using forward slashes (e.g. c:/idea/system). #--------------------------------------------------------------------- # Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- #打開confi的配置 # idea.config.path=${user.home}/config #--------------------------------------------------------------------- # Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- #打開system的配置 # idea.system.path=${user.home}/system #--------------------------------------------------------------------- # Uncomment this option if you want to customize path to user installed plugins folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- #打開plugins的配置 # idea.plugins.path=${idea.config.path}/plugins #--------------------------------------------------------------------- # Uncomment this option if you want to customize path to IDE logs folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- #打開log的配置 # idea.log.path=${idea.system.path}/log
將idea.config.path和idea.system.path里面的${user.home}改成將要存放目錄的位置,我這里修改為D:/Program/JetBrains,如下是修改后的結果
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- idea.config.path=D:/Program/JetBrains/.IntelliJIdea/config
- #---------------------------------------------------------------------
- # Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
- #---------------------------------------------------------------------
- idea.system.path=D:/Program/JetBrains/.IntelliJIdea/system
#--------------------------------------------------------------------- # Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- idea.config.path=D:/Program/JetBrains/.IntelliJIdea/config #--------------------------------------------------------------------- # Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes. #--------------------------------------------------------------------- idea.system.path=D:/Program/JetBrains/.IntelliJIdea/system
注意:一定要將配置項前面的注釋符(#)去掉,否則不生效。
接下來,重啟IDEA工具就可以了。