本教程基于 JetBrains IntelliJ IDEA 2020.3.2 编写。
JetBrains IntelliJ IDEA 下载地址:JetBrains IntelliJ IDEA 官网
软件安装完成后,先修改配置文件存放路径,修改配置文件路径后,会导致之前的配置因误操作失效,所以建议先修改在配置。
- 进入 IDEA 安装位置的bin目录;
- 找到 idea.properties 文件,编辑这个文件;
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE config folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.config.path=${user.home}/.IntelliJIdea/config
idea.config.path=D:/Tools/JetBrains/IntelliJ IDEA 2020.3.2/config
#---------------------------------------------------------------------
# Uncomment this option if you want to customize path to IDE system folder. Make sure you're using forward slashes.
#---------------------------------------------------------------------
# idea.system.path=${user.home}/.IntelliJIdea/system
idea.system.path=D:/Tools/JetBrains/IntelliJ IDEA 2020.3.2/system

JetBrains IntelliJ IDEA 2020.3.X 安装文件:
https://www.jb51.net/article/196349.htm
JetBrains IntelliJ IDEA 优化教程
JetBrains IntelliJ IDEA 分为两个版本:旗舰版(Ultimate)和社区版(Community)。旗舰版收费(30天免费使用时间,功能齐全);社区版(永久免费,功能简陋)。
1.目录结构解释

bin:容器,执行文件和启动参数等
help:快捷键文档和其他帮助文档
jbr:Java 运行环境
lib:IDEA 依赖的类库
license:各个插件许可
plugins:插件
其中:bin 目录下:

以我的电脑系统(64位 windows10,16G内存)为例,说明一下如何调整 VM 配置文件:
-Xms128m
-Xmx750m
-XX:ReservedCodeCacheSize=512m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-ea
-Dsun.io.useCanonCaches=false
-Djdk.http.auth.tunneling.disabledSchemes=""
-Djdk.attach.allowAttachSelf=true
-Djdk.module.illegalAccess.silent=true
-Dkotlinx.coroutines.debug=off
大家根据电脑系统的位数,选择 32 位的 VM 配置文件或者 64 位的 VM 配置文件。
32 位操作系统内存不会超过 4G,所以没有多大空间可以调整,建议不用调整了。
64 位操作系统中 8G 内存以下的机子或是静态页面开发者是无需修改的。
64 位操作系统且内存大于 8G 的,如果你是开发大型项目、Java 项目或是 Android 项目, 建议进行修改,常修改的就是下面 3 个参数:
|
1-16G |
16G以上 |
-Xms |
128m |
512m |
-Xmx |
750m |
1500m |
-XX:ReservedCodeCacheSize |
240m |
500m |
2.设置显示常见的视图

3.设置主题

4.设置窗体及菜单的字体及字体大小

5.设置默认项目路径&打开新项目方式

6.设置适合自己的快捷键风格

7.设置鼠标滚轮修改字体大小

勾选此设置后,增加 Ctrl + 鼠标滚轮快捷键来控制代码字体大小显示。
8.设置自动导包功能

Add unambiguous imports on the fly:自动导入不明确的结构
Optimize imports on the fly:自动帮我们优化导入的包
9.设置显示行号和方法间的分隔符

Show line numbers:显示行数。我建议一般这个要勾选上。
Show method separators: 显示方法分隔线。这种线有助于我们区分开方法,所以建议勾选上。
10.忽略大小写提示

11.设置取消单行显示 tabs 的操作

12.设置默认的字体、字体大小、字体行间距

13. 修改当前主题的字体、字体大小、字体行间距

14.修改当前主题的控制台输出的字体及字体大小

15.修改代码中注释的字体颜色

Doc Comment – Text:修改文档注释的字体颜色
Block comment:修改多行注释的字体颜色
Line comment:修改当行注释的字体颜色
16.设置超过指定 import 个数,改为*

17.修改类头的文档注释信息

/**
* <p>
*
* </p>
*
* @author:bood
* @date:${DATE}
*/
18.添加类、方法注释
       
类注释:
/**
* <p>
*
* </p>
*
* @author: bood
* @date: $date$
*/
方法注释:
/**
* <p>
*
* </p>
*
* @return: $return$
$params$
* @author: bood
* @date: $date$
*/
关键字表达式:
date date()
return methodReturnType()
params groovyScript("if(\"${_1}\".length() == 2) {return '';} else {def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList();for(i = 0; i < params.size(); i++) {if(i<(params.size()-1)){result+=' * @param ' + params[i] + ': ' + '\\n'}else{result+=' * @param ' + params[i] + ': '}}; return result;}", methodParameters());
19.设置项目文件编码

20. 设置自动编译

21.Debug 的设置

设置 Debug 连接方式,默认是 Socket。Shared memory 是 Windows 特有的一个属性,一般在 Windows 系统下建议使用此设置,内存占用相对较少。
常用断点调试快捷键

22.Maven 的配置
Maven 的下载 – 解压 – 环境变量的配置这里就赘述了。下面直接整合 Maven。选择自己 Maven 的目录,和 settings 文件,然后配置自己的仓库 reposiroty。

Maven home path:可以指定本地 Maven 的安装目录所在,因为我已经配置了 MAVEN_HOME 系统参数,所以直接这样配置 IntelliJ IDEA 是可以找到的。但是假如你没有配置的话,这里可以选择你的 Maven 安装目录。此外,这里不建议使用 IDEA 默认的。
User settings file / Local repository:我们还可以指定 Maven 的 settings.xml 位置和本地仓库位置。
23.取消更新

24.过滤文件及文件夹

建议添加如下忽略:
*.iml
*.idea
*.gitignore
*.sh
*.classpath
*.project
*.settings
25.使用Alt + Insert,生成serialVersionUID
搜索:Serialization issues

26.消除IDEA常见警告
代码中大量的波浪线
搜索:General

Spring Autowriting警告

JetBrains IntelliJ IDEA 必备插件
Lombok(新版本中已内置):开发神器,可以简化你的实体类。
GenerateAllSetter:只要你选中需要生成set,get方法的对象,按下快捷键 alt+enter,自动生成set,get方法。
mybatis-log-plugin:从控制台提取一个的输出sql语句。
Free Mybatis plugin:Free Mybatis plugin 非常方便进行 Mapper 接口和 XML 文件之间跳转。
RestfulToolkit:RESTful 服务开发辅助工具集(安利,可以直接在右侧的RestServices查看,所有项目的restful接口,还可以通过 Ctrl \ 全局搜索 )。
Easy Code:支持自定义模板的代码生成插件。
Translation:中英文翻译工具。
JRebel for IntelliJ:热部署插件。
Maven Helper:方便显示maven的依赖树,处理冲突的好帮手。
FindBugs-IDEA:代码审查。
Alibaba Java Coding Guidelines:阿里的开发设计规范。
到此这篇关于JetBrains IntelliJ IDEA 优化教超详细程的文章就介绍到这了,更多相关JetBrains IDEA 优化内容请搜索社区以前的文章或继续浏览下面的相关文章希望大家以后多多支持社区! |