

IntelliJ IDEA 配置
source link: https://segmentfault.com/a/1190000041150597
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

IntelliJ IDEA 配置
IntelliJ IDEA是一种商业化销售的Java集成开发环境(Integrated Development Environment,IDE)工具软件,由JetBrains软件公司(前称为IntelliJ)开发,提供Apache 2.0开放式授权的社区版本以及专有软件的商业版本,开发者可选择其所需来下载使用。 --wikipedia
1.1 编码
一般来说,在没有任何配置的情况下,IntelliJ IDEA 默认的编码是使用系统的编码,在有些中文语言的 Windows 版本上的编码是 GBK
,这会导致你的 IntelliJ IDEA 的编码也是 GBK,因此一开始使用该编辑器的时候可以检查下编码。
Preferences -> Editor -> File Encodings
你还可以勾选 Transparent native-to-ascii conversion
选项,将 Unicode
字符转换成指定的编码,默认使用 UTF-8
即可。这是因为 .properties
文件是 ISO-8859-1
的编码,对于无法识别的字符会翻译成 Unicode
。勾选之后效果如下:
hello=\u4F60\u597D,\u4E16\u754C hello=hello,world
hello=你好,世界 hello=hello,world
1.2 字体与字体大小
Preferences -> Editor -> Font
推荐使用等宽风格字体,个人比较喜欢 JetBrains Mono
。
该字体效果预览如下:
1.3 自定义文件模版
Preferences -> Editor -> File and Code Templates
使用 IntelliJ IDEA 中创建一个类,比如 App
,创建之后的格式如下:
public class App { }
有时候我们希望在类上面添加一些额外的信息,比如作者、日期等。这时候我们就可以自定义文件模版,在 Description 中描述可以引用的变量:
可以将文件同步更新在:
Class
:类。Inteface
:接口。Enum
:枚举。AnnotationAtype
:注解。
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end #parse("File Header.java") /** * @author <a href="mailto:[email protected]">shaw</a> */ public class ${NAME} { }
设置后效果如下:
/** * @author <a href="mailto:[email protected]">shaw</a> */ public class App { }
1.4 代码外观设置
Preferences -> Editor -> General -> Appearance
1.5 智能提示
Preferences -> Editor -> General -> Code Completion
不勾选效果:
勾选效果:
1.6 缩进
Preferences -> Editor -> Code Style -> Java
勾选使用 Tab 缩进,否则使用空格缩进。
1.7 显示文件的详细信息
View -> Appearance -> Deetails in Tree View
2. 构建/部署/执行
2.1 配置Maven
Preferences -> Build, Execution, Deployment -> Build Tools -> Maven
2.2 委托给Maven运行
Preferences -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner
2.3 热部署
Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler
2.4 设置项目的JDK
Preferences -> Build, Execution, Deployment -> Compiler -> Java Compiler
Preferences -> Build, Execution, Deployment -> Build Tools -> Maven -> Runner
3. 导入导出配置
Recommend
-
145
Early Access Program Features IntelliJ IDEA 2017.3 Public Preview...
-
87
What’s New in IntelliJ IDEA 2022.2 IntelliJ IDEA 2022.2 includes multiple quality improvements to the remote development functionality,...
-
100
前言# IDEA是一个智能开发工具,每个开发者的使用习惯不同,如何个性化自己的IDEA?我们可以通过Settings功能来设置。Settings文件是IDEA的配...
-
68
-
63
-
66
-
18
Intellij IDEA 完美配置,让你爱不释手 Never really desperate, only the lost of the soul. ...
-
6
毋庸置疑 IntelliJ IDEA 已经成为 Java 开发最好用的开发工具,这篇文章主要记录自己使用 idea 开发过程中的一些常用配置,主要是根据自己的开发习惯进行的配置,记录这篇文章的目的是为了便于自己查询配置,并且希望对看这篇文章的小伙伴提供一些参考。
-
8
Maven简介 在了解Maven之前,我们先来看看一个Java项目需要的东西。首先,我们需要确定引入哪些依赖包。例如,如果我们需要用到commons logging,我们就必须把commons logging的jar包放入classpath。如果我们还需要log4j,就需要把log4j相关的jar包都...
-
11
IDEA常用设置(提高开发效率) IDEA是一款当前比较主流的编译器,我个人也用的比较多,但是有时出于各种原因,比如更换设备等等,IDEA总是需要重新安装配置。这就让我比较苦恼,因为总是记不全自己之前都修改了哪些地方(原谅脑子不好使hh),所以就以...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK