不管你将 IntelliJ 装在什么地方,它都会在 C 盘的用户目录下创建 .IntelliJIdeaXX 目录,而且这个目录会随着时间增长到几个 G 那么大。这会占用C盘的空间,为了不占用C盘空间,可以更改配置,把idea配置文件放到其它分区中去。
如果用户目录和系统盘在一个分区,那系统盘分区可用空间就会变小,系统重装时,这个目录还会被删除。
修改intellij idea安装目录下 \bin\idea.properties文件,将所有的 ${user.home} 替换为自定义位置 (注意斜杠的方向)(注意要把#去掉,去掉#才会起作用)
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
将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
接下来,重启IDEA工具就可以了。
同样按照上面的方法也可以修改DataGrip的缓存目录