IntelliJ IDEA 常用配置

来源:互联网 发布:asp.net编程 编辑:程序博客网 时间:2024/06/05 19:12

版权声明:本文为博主原创文章,如需转载,请写明出处, 尊重他人即尊重自己(^_^)。
http://blog.csdn.net/aubdiy/article/details/78855890

参考了 IntelliJ IDEA使用教程(http://www.phperz.com/article/15/0923/159068.html)

模板配置

image

Preferences -> Appearance & Behavior -> Appearance -> Theme

  • 选择 Darcula (黑色)

文件编码修改

image

Preferences -> Editor -> File Encodings

  • Global Encoding 选择 UTF-8
  • Project Encoding 选择 UTF-8
  • Properties Files(*.properties) 中 Default encoding for properties files 选择 UTF-8, 同时 勾选 Transparent native-to-ascii conversion

编译器的设置和选择

image

Preferences -> Build,Execution,Deployment -> Compiler

  • 去掉 Build projet automatically 的勾选,取消自动编译
  • Build process heap size(Mbytes) 调整编译内存:64位系统建议 1024 以上

image

Preferences -> Build,Execution,Deployment -> Compiler -> Java Compiler

  • Project bytecode version 设置成 1.8, 默认使用JDK 1.8 (根据需求自行设置)

常用设置

代码提示和补充功能特性设置

image

Preferences -> Editor -> General -> Code Completion

  • Case sensitive completion 设置成 Node, 不区分大小写

导包设置

image

Preferences -> Editor -> General -> Auto Import

  • 勾选 Add unambiguous imports on the fly,IntelliJ IDEA 将在我们书写代码的时候自动帮我们优化导入的包,比如自动去掉一些没有用到的包。
  • 勾选 Optimize imports on the fly (for current project),IntelliJ IDEA 将在我们书写代码的时候自动帮我们导入需要用到的包。但是对于那些同名的包,还是需要手动 Alt + Enter 进行导入的,IntelliJ IDEA 目前还无法智能到替我们做判断。

image

Preferences -> Editor -> Code Style -> Java -> Imports

  • 当我们 Java 类中导入的某个包下类超过 Class count to use import whith '*' 设置的指定个数,就会换成用 * 号来代替。建议设置成大一些,不用 *
  • 相反,控制静态属性引入的 Name count to use static import with '*', 建议保留默认值 ‘3’

注释

image

Preferences -> Editor -> Code Style -> Java -> Code Generation

  • 勾选 Line comment at first column, 单行注释的两个斜杠跟随在代码的头部。

推荐插件

  • Alibaba Java Coding Guidelines 阿里巴巴 JAVA 代码规范检查插件
  • Lombok plugin 自动生成geter\seter\equals\hashcode 插件
  • FindBugs 代码错误检查插件
  • Free Mybatis plugin 方便查看 Mapper 类与 mybatis 配置文件映射的插件
  • CamelCase 驼峰命名相互转换插件