IDEA2021.2 installation and configuration (continuous updates)

IDEA2021.2 installation and configuration (continuous updates)

1. Download

download link:https://www.jetbrains.com/zh-cn/idea/download/other.html

Select the corresponding version to download. Here we take the Windows Ultimate 2021.2.3 version as an example.

2. Installation

Change installation location

Create desktop shortcut

3. Configuration

3.1. Configuration takes effect globally

Do not open the project, set it directly here, it will take effect for all projects

3.2. First startup

You can export the configuration later and use it directly on a new computer.

3.3. Activation

Please support the genuine version! ! !

3.4. Font, font size


Set the ⿏ mark wheel to adjust font size

3.5. Color scheme

3.6. Annotations take effect

Need to install lombok plug-in

3.7. Automatically guide and move packages

3.8. Auto-complete shortcut keys

3.9. Format code

Ctrl + Alt + L conflicts with QQ locking, replace with Ctrl + Shift + L

3.10. Code ignores case

3.11, git configuration

3.12. Click to open the file

3.13. maven configuration


Search dependencies are first obtained from the specified local repository.

-DarchetypeCatalog=internal


jdk

3.14. Method to run the same project multiple times (start multiple consumers)

3.14.1. Method 1

Then change the port and start again. This is suitable for SpringBoot projects.

If multiple main() methods are started, it means that the current main method is not allowed to run in parallel.

solve:
Find the IDEA toolbar, click the drop-down symbol, and click Edit Configuration…


Then start the main() method, and you can start multiple

3.14.2. Method 2



start up

3.15、ECMAScript(ES6)

The default in 2021 is ES6, and in 2019.3 it is ES5. It is recommended to change to ES6, otherwise there are many JS syntaxes that are not supported.

3.16. Add separators between methods

3.17. Display line number

3.18. IntelliJ IDEA startup settings do not open the previous project by default

There are many projects, and it is quite annoying to enter the previous project every time you open it. If it is a large project, it will take a long time to open it. You can choose to turn off this function.

3.19. Set up git

If git chooses the default installation location during installation, this operation is not required.

3.20. Set background image in IDEA code area

Don’t set the opacity too high, otherwise it will affect the ability to read the code.

Open the code area background image setting page

The setup is complete and I think it’s quite cool! ! !

The background image of the code area cannot be placed directly on it. If you need it, please message me privately.

3.21. Create file template


When you right-click to create a new one, the mapping configuration file Mapper just added will appear.

3.22. Customized Live Template

First create a new template group to facilitate later management.


Then configure your own code template

**
 * @Author: xuxiansheng
 * @Description:  $START$
 * @Date: $date$ $time$
 * @Parms: $parms$
 * @ReturnType: $returnType$
 */



To simulate the effect, enter /** + Enter on the method

$END$Variables are used to define the cursor position after the code template is loaded. In addition, I read blog posts on the Internet and some people use it.$START$,not case sensitive. I was stuck because using it in a comment didn’t work, so I put@Description: $START$Put it on top.

3.23. Change encoding format

3.24. File Types filter files

When SpringBoot is created, there will be many redundant files and folders, which must be deleted manually every time, which is very inconvenient.

Filtering can be done using File Types

Click Apply and it will become very clean

3.25. The SpringBoot configuration file cannot display green leaves (the property prompt disappears)

As shown in the picture, it cannot be likeapplication.propertiesThe icons displayed are the same

solve



Joined successfully

Check the effect and complete the solution

3.26. Idea cannot use npm command

It prompts that npm is not an internal or external command, nor is it an operable program or batch file. This is because the idea is equipped with git instead of cmd. You only need to change git to cmd. 2020.3 and previous versions do not have this problem.

3.27. Clear cache

Some imported dependencies are reported as red, but both maven and code are normal.
Solution: Perform a cache clear

3.28. Import and export configuration

Export configuration

Import configuration
Method 1: Open project

Method 2: The project has not been opened. It is recommended to use this method. It will take effect on all projects and will not affect the configuration of the projects that have been opened.

Select the path to save the export configuration

Click OK

Note: Check whether the existing Git and Maven paths are consistent with the original configured paths. If they are inconsistent, remember to modify them.

3.29. Start hot deployment

1. Open the developer tools and add dependencies to Maven

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
</dependency>

2. Activate hot deployment: shortcut keyCtrl + F9

About hot deployment

  • Restart
    Custom development code, including classes, pages, configuration files, etc., loading location restart class loader
  • Reload
    jar package, loading location base class loader

3. Automatically start hot and hot deployment without using shortcut keysCtrl + F9

Use versions before DEA2021.2ctrl + shift + alt + /,chooseRegistry, checkCompiler autoMake allow when app runningoptions.

4. Hot deployment scope setting

Directory list that does not trigger restart by default

  • /META-INF/maven
  • /META-INF/resources
  • /resources
  • /static
  • /public
  • /templates
    5. Customize items that do not participate in restart queuing
spring:
  devtools:
    restart:
      enabled: true #Set to enable hot deployment
      # Set files and folders that will not participate in deployment
      exclude: static/**,public/**

6. Turn off hot deployment

spring:
  devtools:
    restart:
      # Set to turn off hot deployment
      enabled: false  
      # Set files and folders that will not participate in deployment
      exclude: static/**,public/**

3.30. Add Servicesp window

By default, there is no Services window after creating a SpringBoot project. If it is a microservice project, it is very inconvenient to manage the project.

Bring up the Servicesp window

1. Click the upper right corner and select “Edit Configrations…”

Click “+” and select “Spring Boot”

Click OK

Select “Use Services” in the lower right corner

Show Services window

3.31. Open the Toolbar tool


Added successfully

3.32. Set comment color

3.33. Double slash comments are changed to follow the code header.


3.34. Parameter name prompt when completed

4. Plug-ins

4.1、Vue.js

Support vue syntax

4.2、Translation

The translation plug-in translates the English in the code and logs, which is of great help to students with weak English proficiency.

4.3、lombok

Lombok is a Java utility that helps developers eliminate Java verbosity, especially for simple Java objects (POJOs). It does this through annotations. By implementing Lombok in a development environment, developers can save a lot of time building methods such as hashCode() and equals() and sorting various accessors and mutators.

4.4、arthas idea

Resolve issues in production environments with Java-based applications without modifying code or restarting the server.
Use the document address:https://www.yuque.com/arthas-idea-plugin

4.5、Grep Console

The color log plug-in is very convenient for viewing logs and quickly locating error information in the logs.

4.6、Alibaba Java Coding Guidelines

Alibaba Java Code Alibaba Specification Detection Tool

4.7、Code Glance

The mini zoom map plug-in in the code editing area displays a small code map on the far right side of the editing code.

4.8、Presentation Assistant

Shortcut key display can be displayed when recording video. It is not recommended for developers to turn it on.

4.9、seat

IDEA sedentary reminder plug-in

Tutorial

  1. github address:https://github.com/s-unscrupulous/idea_seat
  2. Install plugin
    Open settings –> Plugins –> Gear –> Install Plugin from Disk…, select the jar package downloaded in advance, and restart IDEA after installation.
  3. Enable plug-in
    Select Tools –> Assistant setting on the toolbar to set the reminder time.

    Pop up setting interface

    After the setting is completed and the set time is reached, IDEA will pop up a prompt to remind us to exercise.

4.10、Chinese ​(Simplified)​ Language Pack / Chinese Language Pack

The Chinese language pack localizes the UI of IntelliJ IDEA, AppCode, CLion, DataGrip, GoLand, PyCharm, PhpStorm, RubyMine and WebStorm into Chinese.

After installing the plug-in, restart IDEA and the Chinese version is completed.

4.11、Codota AI Autocomplete for Java and JavaScript

Code smart prompt plug-in

4.12、CamelCase

Camel case naming and underline naming conversion, shortcut keys for quick conversion:Shift + Alt + U

4.13、MyBatis X

MybatisX plug-in features

  • mapper and xml can jump back and forth
  • mybatis.xml, mapper.xml prompt
  • mapper and xml support automatic prompting like jpa (refer to MybatisCodeHelperPro)
  • Integrated mybatis generator gui (copied from free mybatis plugin)

4.14、 statistic

The plug-in in IDEA is used to count the amount of code. After installing the plug-in, the statistics window will be displayed at the bottom. If this window is not displayed, you can use “View” –> “Tool Windows” –> “statistic”.

How to use:

5. maven installation

5.1. maven download

download link:https://maven.apache.org/download.cgi

5.2. Decompression

Unzip the maven compressed package to D:\Java. It can be used in folders that cannot contain Chinese, spaces or other special characters.

5.3. Configure environment variables

The use of maven is based on jdk, so the computer must have jdk
Step 1: Add environment variable: MAVEN_HOME

Step 2: Add: %MAVEN_HOME%\bin to the path environment variable


Step 3: Test: Hold down win+R and enter cmd to enter the black window console. Enter the command: mvn -v
If the following maven version information appears, it means that the installation of maven and the configuration of environment variables are correct;

5.4. Configure warehouse

Generally, we need to reset the address of the local warehouse ourselves. The setting method is as follows:

  • 1. Create a repository folder in the maven installation directory (it is generally customary to place the warehouse address and the maven installation directory together)
  • 2. In the core configuration file setting.xml, set the warehouse storage location to: D:\Java\apache-maven-3.8.1\repository (subject to your own installation path)
<localRepository>D:\Java\apache-maven-3.8.1\repository</localRepository>

5.5. Configure Alibaba Cloud warehouse

Comment the original sub-nodes under the mirrors node, and add new sub-nodes

<mirrors>
  <!-- mirror
   | Specifies a repository mirror site to use instead of a given repository. The repository that
   | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
   | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
   |
  <mirror>
    <id>mirrorId</id>
    <mirrorOf>repositoryId</mirrorOf>
    <name>Human Readable Name for this Mirror.</name>
    <url>http://my.repository.com/repo/path</url>
  </mirror>
   -->
	<! -- Annotate the original child node
	<mirror>
	  <id>maven-default-http-blocker</id>
	  <mirrorOf>external:http:*</mirrorOf>
	  <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
	  <url>http://0.0.0.0/</url>
	  <blocked>true</blocked>
	</mirror>
	-->

	<! -- Add a new child node -->
	<mirror>
	  <id>aliyunmaven</id>
	  <mirrorOf>*</mirrorOf>
	  <name>Alibaba Cloud Public Warehouse</name>
	  <url>https://maven.aliyun.com/repository/public</url>
	</mirror>
</mirrors>

6. Configure Tomcat

6.1. Download Tomcat

Official websitehttps://tomcat.apache.org/

Unzip it to the D:\Java directory

6.2, IDEA deployment Tomcat

First use IDEA to create a maven web project, and then operate as shown below







Save and start Tomcat test
accesshttp://localhost:8080/webTest/, returns “Hello World!” indicating that Tomcat configuration is completed!

7. IDEA shortcut keys

7.1. Commonly used shortcut templates

shortcut keyintroduce
mainCreate main method
psvmCreate main method
soutprintout
soutmPrint current method name
soutpPrint the parameters of the current method
soutvPrint the most recent variable
foriCreate a for loop
forrCreate a reverse for loop (array.forr)
ritarCreate a reverse for loop
iterEnhance for loop
ifnNull value judgment (null)
innNon-empty judgment (null)
prsfCreate private static constants
psfCreate public static constants
psfiCreate a public int type constant
psfsCreate public String type constants

7.2. Commonly used shortcut keys

shortcut keyintroduce
Ctrl + FSearch text in the current file (required)
Ctrl + RText replacement in current file (required)
Ctrl + YDelete the line of code where the cursor is located or delete the selected line of code (required)
Ctrl + DCopy the line of code where the cursor is located or copy the selected line of code (required)
Ctrl + /Comment the line of code where the cursor is located or comment the selected line of code (required) single line comment
Ctrl + Shift + /Comment the line of code where the cursor is located or comment the selected line of code (required) multi-line comment
Alt + EnterPrompt for quick fix code selection (the cursor must be placed on the error) (required)
F2Jump to the location where the program reports an error (required)
Alt + InsertGenerate code, generate Getters, Setters, constructors, etc. (required)
Shift + EnterAutomatically open a new line below the current cursor position (required)
Ctrl + Alt + LFormatting code (conflicts with QQ hotkeys, replacement is recommended) (required)
Shift + F10Run Java program
Ctrl + ZUndo operation
Ctrl + Shift + ZRestore operation (conflicts with Sogou input method hotkey)
TabIndent code
Shift + TabUnindent
Ctrl + +Expand current method
Ctrl + Shift + +Expand all methods
Ctrl + –Collapse current method
Ctrl+ Shift + –Collapse all methods
Ctrl + BView the location of the current class, method or variable definition (equivalent to holding down the Ctrl key + left click)
Ctrl + NFind related classes based on the specified class name
Ctrl + OOverride parent class method
Ctrl + IImplement interface methods
Ctrl + HView current class structure
Ctrl + Alt + left and right arrow keysSwitch to the previous or next code operation
Alt + left and right arrow keysswitch files
Alt + up and down arrow keysThe cursor jumps to the previous method
Alt + Shift + up and down arrow keysMove the currently selected code
Ctrl + Shift + EnterAutomatically add a semicolon to the end of the current line
Double clickShiftSearch pop-up window pops up

Related Posts

Modify the built-in user password in elasticsearch version 8.0 or above

Use java to implement a simple calculator

Java API to operate HBase

Details of automotive project based on SSM and Shiro

To merged Charts

Summary of 20 excellent domestic low-code platforms/vendors

[MC Tutorial] Launch the Java version of mc on iPad (no jailbreak required) (nanny level?) Jitterbug launches the iOS Minecraft Java version launcher PojavLauncher

springboot uses redis

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*