IDEA 全局设置
新安装的IDEA 常用的设置。
全局设置,让新项目创建、打开时也就能生效的设置。
Other Settings
注意ctrl + alt + s 是当前项目的设置,并不能全局生效(新项目)
Settings for new Projects
File --> Other Settings --> Settings for new Projects
-
设置 字符集 File Encodings [Editor --> File Encodings]
UTF-8 UTF-8 UTF-8 with NO BOM
-
设置 自动生成 SerialVersionUID [Editor --> Inspections]
搜索 SerialVersionUID 找到 并 勾选 Serialzable class without ‘SerialVersionUID’
-
设置默认 JDK版本 [Build,Execution,Deployment --> Compiler --> Java Compiler]
-
设置maven (直接搜maven) [Build,Execution,Deployment --> Build Tools --> Maven]
-
设置tmeplate(直接搜 temp) [Editor --> File and Code Templates]
找到需要的文件,加上模板信息即可
如 期望每次创建claas时自动添加创建信息的注释,找到 Class
package ${PACKAGE_NAME};
/**
* @author: Gargantua
* @date: ${DATE} ${TIME}
*/
public class ${NAME} {
}
-
设置注释自动缩进 [Editor --> Code Style --> Java --> Code Generatic]
取消勾选Comment Code下
Line comment at first column
Block comment at first column
其他语言就找对应语言的设置 -
设置自动import时合并为*的数量阈值[Editor --> Code Style --> Java --> Imports]
Class count to use import with '*': 99 Names count to use static import with '*': 99
Structure for new Projects
设置 Project
- Project SDK --> 1.8
- Project language level --> 8 -Lambdas,…
设置 SDKs // 设置过 Project SDK 会带出
IDEA 其他设置
IDEA 2021 可根据鼠标滚轮设置字体大小。
需打开 Editor --> Gerneral --> [勾选] Change font size with Ctrl + Mouse Wheel
模块不被识别
-
可能是没有本地依赖model
找到无法被导入的模块,打开pom.xml文件,在文件任意位置中右键,选择:Add as Maven Project -
可能版本控制里设置了忽略pom.xml
.idea里的没有这个module,或被注释
project structure 添加这个module