Creating and running (2) IDEA common configuration, project templates, and JavaWeb

Common arrangement

  • IntelliJ IDEA has many user-friendly settings, but also because these user-friendly settings for those diehard IntelliJ IDEA powder is more dead set on using it and sharing it.

Enter the setting interface:
Here Insert Picture Description
the directory structure as follows:
Here Insert Picture Description

1、Appearance & Behavior
  • Set the theme
    Here Insert Picture Description
    here by default provides three themes: IntelliJ, Darcula, Windows. Here you can choose according to their preferences.
  • Set the form and menu font and font size (negligible)
    Here Insert Picture Description
  • Added: Setting editing area theme (negligible)

        If you want more theme effects, you can go to the following website: http://www.riaway.com/

        After downloading, importing a theme :( way) file -> import setttings -> select the jar file to download the theme -> all the way to confirm -> Restart. After the restart, the new theme will be automatically enabled. If not enabled, you can choose as follows:
Here Insert Picture Description
        After the download, import theme :( Second way)
Here Insert Picture Description

  • Added: through plug-ins (plugins)

        Like the black theme, you can also download plug-ins: Material Theme UI
Here Insert Picture Description
after the click of a button, in a networked environment following search plugin - install - restart IDEA to:
Here Insert Picture Description

2 Editor - General
  • Setting the mouse wheel to change the font size (negligible)
    Here Insert Picture Description
    we can check after this setting, increase Ctrl + mouse wheel shortcuts to control code font size.
  • Set Hover tips
    Here Insert Picture Description
  • Set up automatic pilot package features
    Here Insert Picture Description
    the Add unambiguous Imports ON at The Fly : automatically import unclear structure
    Optimize Imports ON at The Fly : automatically help us optimize the imported package
  • Setting display separator between the line and the method
    Here Insert Picture Description
    as shown in FIG red circle, can check Show line numbers: the number of lines. I generally recommend to check on this.
    As shown in FIG red circle, you can check the Show method separators: display method of dividing line. This helps separate line method in our district, it is recommended to check on.
  • Set single-line display tabs cancel the operation
    Here Insert Picture Description
    as shown in Note icon, open many files at the time, IntelliJ IDEA default is to open all the file names Tab single-line display. But now my personal habits is to use a multi-line, multi-line efficiency than a single line, because more than a single line will hide the interface section Tab, this is not convenient to find files.
3、Editor – Font
  • Set the default font, font size, line spacing, font
    Here Insert Picture Description
4、Editor – Color Scheme
  • Modify the current theme font, font size, font, line spacing (negligible)
    if the current theme does not want to use the default font, font size, font, line spacing, you can set separately:
    Here Insert Picture Description
  • Modify the console output of the current theme font and font size (negligible)
    Here Insert Picture Description
  • Modify the code in the comment color
    Here Insert Picture Description
       Doc the Comment - Text : modify document annotations font color

          The Comment Block : change the font color multi-line comments

          The Comment Line : change the font color when the line comment

5、Editor – Code Style
  • Set exceeds a specified number of import, read * (negligible)
    Here Insert Picture Description
6、Editor – File and Code Templates
  • 修改类头的文档注释信息
    Here Insert Picture Description
    常用的预设的变量,这里直接贴出官网给的:
    ${PACKAGE_NAME} - the name of the target package where the new class or interface will be created.
    ${PROJECT_NAME} - the name of the current project.
    ${FILE_NAME} - the name of the PHP file that will be created.
    ${NAME} - the name of the new file which you specify in the New File dialog box during the file creation.
    ${USER} - the login name of the current user.
    ${DATE} - the current system date.
    ${TIME} - the current system time.
    ${YEAR} - the current year.
    ${MONTH} - the current month.
    ${DAY} - the current day of the month.
    ${HOUR} - the current hour.
    ${MINUTE} - the current minute.
    ${PRODUCT_NAME} - the name of the IDE in which the file will be created.
    ${MONTH_NAME_SHORT} - the first 3 letters of the month name. Example: Jan, Feb, etc.
    ${MONTH_NAME_FULL} - full name of a month. Example: January, February, etc.
7、Editor – File Encodings
  • Set the project file coding
    Here Insert Picture Description
    Description : Transparent native-to-ascii conversion is mainly used to convert ascii, are generally required to check, or Properties to display the comments in the file will not be Chinese.
  • Set the encoding of the current source file (negligible)
    Here Insert Picture Description
    Here Insert Picture Description
    coding changes to individual files can also click on the lower right corner of the encoding settings. If the code content that contains Chinese, as will pop operation selection. among them:

          ①, Reload indication reload new code, the new code will not be saved to a file, reopen the file, the old code is still what or what.

          ②, Convert For indication to convert new code, the new code will be saved to a file, reopen the file, the new code is what is yes.

          ③, code file containing the Chinese, the Chinese may make after Convert garbled, so please make a backup converted into, or the conversion process may appear garbled, can not be restored.

8、Build,Execution,Deployment
  • Set automatically compile
    Here Insert Picture Description
    build project is the java code we write, the frame profile, international and other resource files, JSP pages and pictures and other resources as "raw materials", to "produce" out of a running process.

          Intellij Idea default status is not automatically compiled state, Eclipse default is automatically compiled: many of my friends are from Eclipse to Intellij, which often
lead us to forget about the java class files modified recompiled when action is required class file, so the old file operation
Here Insert Picture Description

9, is set to the power saving mode (negligible)

Here Insert Picture Description
After shown above, there is something called IntelliJ IDEA of power saving mode, this mode is turned on will turn off IntelliJ IDEA check codes and code tips and other functions. It is generally considered that this is a read mode, if you experience a sudden code file in the development process can not be checked and tips, you can see if there are open the function.

10, the code set horizontally or vertically

Here Insert Picture Description

Set shortcut keys (Keymap)

1, set the shortcut for Eclipse

Here Insert Picture Description

2, modify the shortcut keys shortcut key function

Here Insert Picture Description

3, by specifying shortcut keys, view or modify its function

Here Insert Picture Description

4, import existing settings

Here Insert Picture Description

About template (Templates)

(Editor – Live Templates 和 Editor – General – Postfix Completion)

1, Live Templates (real-time code templates) function
  • Its principle is to configure some common code initials, the code may appear in your fixed pattern predefined in the abbreviated input, allowing developers to greatly improve efficiency, but also can add a personal touch. The simplest example is the input sout will appear System.out.println () in Java;

Template official introduction Live S:

https://www.jetbrains.com/help/idea/using-live-templates.html

2, the existing common template
  • The default Postfix Completion is as follows:
    Here Insert Picture Description

  • Live Templates silent as follows:
    Here Insert Picture Description

  • Difference between the two: Live Templates can be customized, and Postfix Completion can not. At the same time, both operations have provided some templates, Postfix Templates Live Templates can be faster than 0.01 seconds

  • Example:
    PSVM: generate a main method
    sout: System.out.println () Quick output

3, modify an existing template to modify an existing template
  • If for existing templates, not used to the feeling, inappropriate, you can modify:
  • For example:
    by calling psvm Calling the main method used to, you can change, like Eclipse, using the main retrieval.
    Here Insert Picture Description
4, custom templates
  • IDEA provides many ready-made Templates. But you can also create a new configuration using the Template according to their needs.
    Here Insert Picture Description
    First define a template group:
    Here Insert Picture Description
    Here Insert Picture Description
    Select the group from the template definition, click on the "+" to define a template.
    Here Insert Picture Description
    ①, ABBREVIATION : template abbreviated name
    ②, the Description : template description
    ③, Template text : snippet template
    ④, the Define : Applications. For example, click Define. : Select as
    Here Insert Picture Description
    defined above manner can test method, and then to test the java class file.

Create a Java Web Project or Module / div>

1, create a static Java Web

Here Insert Picture Description

2, create dynamic Java Web
  • Engineering bar space new - module:
    Here Insert Picture Description
    Here Insert Picture Description
    Here we must check the Web Application, you can create a Web project.
    Here Insert Picture Description
    It provides Web project name. Note here that tinkering Content root and Module file location. After the creation of the project is structured as follows:
    Here Insert Picture Description
    Open index.jsp. Modified to read as follows. Here you will find the code hinting IDEA better than Eclipse
    Here Insert Picture Description
  • Configuring Tomcat

       Before you configure Tomcat in the IDEA, the need to ensure that Tomcat is already installed and configured the environment variables. Let's look at how to configure the IDEA:
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Configure the name and location of the Tomcat application server configuration here. Depending on the installation location of their decision Tomcat.
Here Insert Picture Description
Other positions default value (set to start the browser and a port number), as described above. Then Deployment:
Here Insert Picture Description
Here Insert Picture Description
Click Apply to. In this case:
Here Insert Picture Description
index.jsp to perform just created: the
Here Insert Picture Description
effect is as follows:
Here Insert Picture Description
Note: The
information displayed after running Tomcat:
Here Insert Picture Description
you can click on the red box, just click finish and can not shut down the server immediately, just disconnect the connection to the server, later, when the stop button is grayed out, it means closed.

Next chapter, (3) IDEA association database, version control, and break-tone arrangement Maven

Published 67 original articles · won praise 19 · views 9857

Guess you like

Origin blog.csdn.net/qq_41530004/article/details/104703267