Java开发的IDEA常用配置,此教程对应的IDEA版本为 v 2019.2.1 Ultimate Edition。
1. 代码自动提示设置
1.1. Java代码自动提示
Window→Preferences→Java→Editor→Content Assist→Auto Activation→Auto activation triggers for java:
将 . 改成以下字符串
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(,['"/<
1.2. Java代码自动提示 关闭联机提示
Window→Preferences→Java→Editor→Content Assist→Advanced
勾选Java Proposals
取消勾选Java Proposals(Code Recommenders)
1.3. HTML代码自动提示
Window→Preferences→Web→Editor→Content Assist→Auto Activation→Prompt when these characters are inserted:
将 . 改成以下字符串
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(,['"/<=
1.4. JavaScript代码自动提示
Window→Preferences→JavaScript→Editor→Content Assist→Auto Activation→Auto activation triggers for JavaScript:
将 . 改成以下字符串
.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(,['"/<=
2. 编码设置
2.1. 设置workspace编码
Window→Preferences→Workspace→Text file encoding→Other:
改成UTF-8
2.2. 设置JSP文件编码
Window→Preferences→Web→JSP File→Creating files→The following encoding will apply:→Encoding:
改成UTF-8
2.3. 设置Properties文件编码
Window→Preferences→General→Content Types→Content types:→Text→Java Properties File→Default encoding:
改成UTF-8
2.4. 设置JSON文件编码
Window→Preferences→JSON→JSON Files→Creating files→The following encoding will apply:→Encoding:
改成UTF-8
3. 基本代码设置
3.1. 设置字体样式
Window→Preferences→General→Appearance→Colors and Fonts→Basic→Text Font→Edit:
3.2. 设置编辑窗口背景色
Window→Preferences→General→Editors→Text Editors→Appearance color options:→Background color→Color:
3.3. 设置大括号高亮颜色
Window→Preferences→Java→Editor→Appearance color options:→Matching brackets highlight→Color:
3.4. 设置大括号成对显示
Window→Preferences→Java→Editor→Bracket highlighting→Matching bracket and caret location
3.5. 设置保存时的自动操作
Window→Preferences→Java→Editor→Save Actions→Perform the selected actions on save→Additional actions→Configure…
3.5.1. 清空行尾空格,调整缩进
Code Oraganizing→Formatter:
Remove trailing whitespace→All lines;
Correct indentation
3.5.2. 清除未使用的引用
Unnecessary Code→Unused code→Remove unused imports
3.6. 添加代码模板
Window→Preferences→Java→Editor→Templates
3.7. 添加本地限定文件
Window→Preferences→XML→XML Catalog→Add…→Catalog Entry
Location:→File System…
选择对应的限定文件(dtd/xsd)
Key type:
若为dtd文件:选择URI;
若为xsd文件:选择Schema location
Key:
粘贴xml中的限定文件路径
3.8. 设置新建列表
Window→Preferences→Perspective→Customize Perspective…→Shortcuts→Submenus:→New
4. 服务器设置
4.1. Tomcat设置
Window→Preferences→Tomcat
Tomcat version:
选择相应Tomcat版本
Tomcat home:
选择相应Tomcat文件目录
4.2 Server设置
Window→Preferences→Server→Runtime Environments→Add…→Apache
5. 链式安装插件
1.将插件置于单独文件夹内(tomcat):
E:\SoftStore\Java\eclipseplugin\tomcat\eclipse\plugins\net.sf.eclipse.tomcat_9.0.1.jar
2.在eclipse\dropins文件夹内新建link文件:
tomcat.link
3.写入插件目录路径:
path=E:/SoftStore/Java/eclipseplugin/tomcat