配置
使用过的版本
下载地址:https://www.jetbrains.com/idea/download/other.html
个人修改版:https://github.com/valuetodays/idea-community-win-for-myself
- IntelliJ IDEA 2023.3.6 (Community Edition)
- 使用时一直正常
- IntelliJ IDEA 2021.3.3 (Community Edition)
- 使用时一直正常
- IntelliJ IDEA 2020.1.4 (Community Edition)
- 使用时一直正常
File and Code Templates
Includes tab
File Header
/**
* .
*
* @author lei.liu
* @since ${YEAR}-${MONTH}-${DAY}
*/
TestFileHeader.java
/**
## description:
## when generate TEST class, generate the class javadoc to link the the source class.
#set($classNameSuffix = "Test")
* Tests for {@link #if (${NAME.endsWith($classNameSuffix)})#set($endIndex = ${NAME.length()} - ${classNameSuffix.length()})${NAME.substring(0, $endIndex)}#else${NAME}#end}.
* @author lei.liu
* @since ${YEAR}-${MONTH}-${DAY}
*/
code tab
Junit5 Test Class
#parse("TestFileHeader.java")
class ${NAME} {
${BODY}
}
Code Style
将如下内容保存到桌面,命令为custom.xml
<code_scheme name="Default" version="173"> <JavaCodeStyleSettings> <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" /> <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99999" /> <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> <value /> </option> </JavaCodeStyleSettings> </code_scheme>依次操作Ctrl+Alt+S -> Editor -> Code Style -> Schema右侧的齿轮 -> Import.. -> 选择桌面的custom.xml文件
idea插件列表
- maven helper
- translation
- grep console
- Lombok
- jclasslib
- Statistic
- key promoter
- Rainbow Brackets
- Indent Rainbow
- String Manipulation
- Diagrams.net Integration
- IDEA Feature Suggester
- Java8 Postfix
- Custom Postfix Templates
- GenerateAllSetter Postfix Completion
- CheckStyle-IDEA
- SonarLint
- SonarQube Community Plugin
- Alibaba Java Coding Guidelines
- codota AI / Tabnine
- AiXcoder Code Completer
- GitHub Copilot
- Awesome Console
- Java Visualizer
- jdk visualgc
- .ignore
- arthas idea
- CodeGlance / CodeGlance Pro
命令行安装插件
参考如下官方文档:
命令如下(记录在$IDEA_HOME/bin目录下执行)
# 以命令行方式安装插件,建议在导入配置(即setting.jar)后再运行,运行时时刻注意 all_config/.ideaC/system/plugins 目录(默认是 C:\Users\Administrator\AppData\Roaming\JetBrains\IdeaIC2021.3\plugins),若没有生成对应的文件,就先只安装GrepConsole,等GrepConsole生成后再执行全量插件的安装,安装不会一次性成功,记录多执行几次,当目录中不再生成新文件时就算完全成功了。
idea64.exe installPlugins GrepConsole
idea64.exe installPlugins GrepConsole MavenRunHelper "String Manipulation" com.aegamesi.java_visualizer.plugin com.codota.csp.intellij com.github.beansoftapp.visualgc.plugin de.endrullis.idea.postfixtemplates gudqs7.github.io.getter-setter-postfix indent-rainbow.indent-rainbow izhangzhihao.rainbow.brackets net.orekyuu.java8postfix
常用
长字符串换行后+放在行首
- File->Settings ->Code Style->Java -> Wrapping and Braces->Binary Expressions->Operation sign on next line,默认是没勾上的 ,勾上Operation sign on next line选项就可以了。可参考https://blog.csdn.net/Jacabe/article/details/79295628。
配置快速调试(快速调试指按一个快捷键即可运行测试方法)
- Ctrl+Alt+S 打开设置,点击Keymap菜单,在右侧输入框中输入“debug context”,右键列表,选“Add Keyboard Shortcut”,配置一个快捷键即可,(我配置的是F10,调试用的多,配置成单个按键比较方便),之后当光标在测试方法里时,按该快捷键即可运行测试方法。
配置右键目录空白有"open with idea"
修改如下的路径,并将修改后的内容保存为open_with_idea.reg,双击运行即可。
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\open with idea]
@="open with idea"
"Icon"="D:\\ws\\apps\\ideaIC-2023.3.8.win\\bin\\idea64.exe"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\background\shell\open with idea\command]
@="\"D:\\ws\\apps\\ideaIC-2023.3.8.win\\bin\\idea64.exe\" \"%V\""
问题
64位 Unable to parse template Class
idea.exe可以新建一个java类文件,而idea64.exe却不能,使用的jdk是8u171。
解决如下(from http://www.mamicode.com/info-detail-2040934.html):
新建class的时候,提示Unable to parse template “Class”,通过查看 Settings -> Editor -> File and Code Templates 可以看到,所有的模板都是空白。这是因为JDK更新到8 Update 144引起的,如果要修复的话,需要在idea.vmoptions 或者 idea64.vmoptions中增加-Djdk.util.zip.ensureTrailingSlash=false 也可以回退回其他JDK版本, 可以避免这个问题。
调优
idea64.exe.vmoptions
-Xms1g
-Xmx1g
-Xverify:none
-Dfile.encoding=UTF-8
-XX:+UseG1GC
-XX:-UseConcMarkSweepGC
-XX:ReservedCodeCacheSize=240m
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-XX:CICompilerCount=2
-Dsun.io.useCanonPrefixCache=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Djdk.attach.allowAttachSelf
-Dkotlinx.coroutines.debug=off
-Djdk.module.illegalAccess.silent=true
-Dide.no.platform.update=true
最后编辑:admin 更新时间:2025-09-19 10:08