IntelliJ IDEA Basic Tutorial

IntelliJ IDEA Basic Tutorial

Original address: IntelliJ IDEA basic tutorial
blog address: http://www.extlight.com

image

I. Introduction

IDEA's full name is IntelliJ IDEA, which is an integrated environment for java language development. IntelliJ is recognized as one of the best java development tools in the industry, especially in intelligent code assistants, automatic code prompts, refactoring, J2EE support, various version tools (git , svn, github, etc.), JUnit, CVS integration, code analysis, innovative GUI design and other functions can be said to be extraordinary.

Demo version: Version 2017.1.4

2. Basic settings

The first time you open IntelliJ IDEA, a navigation interface will appear.

Navigation interface -> Configure -> Settings, as shown below:

image

Then the default settings interface appears:

image

Note: Modifying the settings in this way is a global setting and will affect all future projects.

Another way to set: After creating the project, File -> Settings ..., this way only works on the current project.

2.1 Modify the theme

Default Settings 界面 -> Appearance & Behavior -> Appearance

2.2 Modify the font

Default Settings 界面 -> Editor -> Colors & Fonts -> Font

2.3 Modify the character set

Default Settings 界面 -> Editor -> File Encodings

2.4 Code style

Default Settings 界面 -> Editor -> Code Style -> Java

2.5 Code hints ignore case

Default Settings 界面 -> Editor -> General -> Code Completion

将右侧 Case sensitive completion 设置成 Node。

2.6 自动导包

Default Settings 界面 -> Editor -> General -> Auto Import

将 Insert imports on paste 设置成 All。

同时勾选 Add unamiguous imports on the fly 和 Optimize imports on the fly。

2.7 取消最后编辑工程

默认情况下,再次启动 IDEA 会打开最后编辑工程,如果现取消该设置,可以如下操作:

Default Settings 界面 -> Appearance & Behavior -> System Settings

取消 Reopen last project on startup 的勾选。

三、插件安装

Default Settings 界面 -> Plugins,右侧出现插件列表,共有三种安装插件方式:

image

根据实际情况点击底部提供的 3 个按钮安装插件即可。

四、配置 JDK

导航界面 -> Configure -> Project Defaults -> Project Structure,

弹出新窗口,修改 Project SDK 即可:

image

五、创建 JavaSE 工程

如图示:

image

六、设置 JVM 参数

编辑界面 -> Help -> Editor Custom VM options ...

根据机器实际情况设置参数,笔者笔记本内存 12G ,设置参数如下:

# custom IntelliJ IDEA VM options

-Xms1024m
-Xmx2048m
-XX:ReservedCodeCacheSize=500m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow

七、创建 Java Web 工程

如图示:

image

八、配置 Tomcat

编辑界面 -> 倒三角按钮 -> Edit Configurations

image

弹出 Configurations 界面,根据下图所示,选择 Tomcat Server 设置:

image

之后会弹出新窗口,设置 Tomcat 目录即可。

九、添加第三方 jar 包

先将 jar 拷贝到项目中,具体操作如下图所示:

image

After saving, we have one more step:

image

10. Configure Maven

Default Settings 界面 -> Build,Execution,Deployment -> Build Tools -> Maven

Eleven, create a Maven project

image

12. Configure SVN

12.1 Setting up svn.exe

Default Settings 界面 -> Version Control -> Subversion

On the right, set the path of svn.exe and check the box in front.

For convenience, readers can directly install TortoiseSVN, which contains svn.exe.

12.2 Upload project

Edit interface -> VCS -> Import into Version Control -> Share Project (Subversion)

Fill in the svn server address in the pop-up window to upload the project to the SVN server.

Ignore uploaded files/folders: Edit interface -> File -> Settings -> Version Control -> ignored Files, just add the file path on the right.

12.3 Download Project

Edit interface -> VCS -> Check out from Version Control -> Subversion

Select/add svn address to download the project in SVN.

12.4 Updating/Committing Documents

In the menu bar of the editing interface, there are two vcs buttons, of which the down arrow means updating the file, and the up arrow means submitting the file.

Thirteen, configure GIT

13.1 Setting up git.exe

Default Settings 界面 -> Version Control -> Git

Set the git.exe path on the right.

13.2 Starting GIT

Edit interface -> VCS -> Enable Version Control Integration

In the pop-up window, select git.

14. References

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324517238&siteId=291194637