If you want to do a good job, you must sharpen your tools! It takes a whole day for new employees to set up the development environment. I really worry about it!
Today, Chen specially took the time to sort out the skills of using IDEA in Java development over the past 5 years, all of them are in the following!
Archen configuration
Set up Chinese
Recently, IDEA has released an official Plug-in in Chinese, finally taking into account the friends who are not good at English in China.
Installation is also very simple, plug-in search Chinese
The theme
What I use is One Dark, match little sister wallpaper again, develop up happy!
The theme can be found in the plugin search OneDark.
background
Watching your little sister write code makes you feel better!
Settings > Appearance > Background image, you can configure it.
The font
I use Source Code Pro + 14 size, which I think is the most suitable for me.
Set the shortcut keys, which iskeymap
Since you are used to Eclipse, you will have to change to Eclipse shortcuts
The code prompts are case insensitive
This is important, because it is impossible to pay attention to case all the time, and not prompt prompt will waste too much time and affect the development experience.
IDEA Indicates the configurations of earlier versions
IDEA 2020 after this match
Automatic import package and import package optimization Settings
Java code is commented by default
This sees the company request, but general can ask class annotation and leave author information, convenient later install force (oh not, it is to pursue responsibility)
Comment code is up to you, here’s an example:
/** * created By gcdd1993 on ${Date} */
Copy the code
The class then created looks like this:
/**
* created By gcdd1993 on 2021.07.23
*/
public class Person {
//
}
Copy the code
IntelliJ IDEA startup Settings do not open the previous project by default
There are many projects, every time open into the last project, very annoying, in case of a big project, open will take a long time, we just close this function.
Common plug-in
Over the years, the idea has been used countless plugins, but in fact there are a few easy to use, you are recommended to install!
.ignore
Automatically generate.ignore files and add files to the.ignore list with one click
Grep Console
In the console support selection, similar to the Shell command the cat 1. TXT | grep ’11’, this is very useful
Lombok plugin
This does not explain a plug-in you must install to use Lombok
CodeGlance
Code editing area mini zoom plug-in, very easy to use
HighlightBracketPair
Automatic highlighting of parentheses corresponding to the block of code where the cursor is located, customizable colors and shapes, and no more code blinding
Rainbow Brackets
Color shows all parentheses, same as the last one, care for the eyes, everyone’s responsibility
Alibaba Java Coding Guidelines
Alibaba Java development manual supporting plug-in, a key scan to help you optimize the code.
Codota
(Actually AI trained the open source code on Github and then matched it to make hints)
EasyYapi
One-click export interface to Postman and EasyYapi, a artifact that greatly simplifies development and testing time
Use Alt + INSERT on the interface class you want to export for a quick export
The following figure shows an example of the exported interface
MybatisCodeHelper Pro
This is basically one of the plugins installed by anyone using Mybatis, if you use Spring Jpa, forget it.
All kinds of quick tips, code generation, worry!
Mybatis Log Plugin
This is another Mybatis must install plug-in, debugging efficiency is very high. Help you put Mybatis Sql assembly, direct copy can be debugging.
There are some other plug-ins, such as Docker, Go Template, MapStruct, etc., but they are only used in specific scenarios. When there is time, Chen will mention them separately.
Configuration synchronization
The official IDE Settings Sync or Settings Repository can only synchronize a small number of configurations. Every time the system crashes or you change your computer, you still have to spend a lot of time reconfiguring it.
So Achen will be migrated to the code warehouse, each time only need to spend 1 minute time can be configured!
1, enter theIDEA
The installation directory
Modify bin/idea.properties to save our configuration in the same directory as the installation directory
# idea.config.path=${user.home}/.IntelliJIdea/config
idea.config.path=../config
# idea.plugins.path=${idea.config.path}/plugins
idea.plugins.path=../config/plugins
Copy the code
2. In the installation directory, create a new directoryconfig
If there is an old configuration, you can copy it to it${user.home}/.IntelliJIdea/config
The following.
Go to the config directory and run the following command to save the configuration to the code repository
git init
git remote set-url git.xxx # Configure as your repository address
Copy the code
3, into theconfig
Directory, newsync.sh
#! /bin/bash
DATE=$(date '+%Y-%m-%d %H:%M:%S')
git pull
git status
git add .
git commit -m "Backup on ${DATE}."
git push -u origin master
Copy the code
This way, periodically execute the sync.sh script to synchronize the configuration and plug-in at the same time.
Configuration to recover
When reinstalling the system, just change bin/idea.properties and execute it in the installation directory
git clone git.xxx config
Copy the code
Ok, and then directly open the IDEA, into the development, efficiency of the bar!
If this blog has been helpful to you, please remember to leave a comment + like + bookmark.
I am Chen, on the road of technology we forge ahead together!