Before creating, you must first configure maven, the specific configuration view: Java project construction management Maven installation and configuration
My development environment version: IntelliJ IDEA 2019.2.3
1、File - New - Project - Maven
;
2. First Project SDK
select the jdk version you installed, such as java 1.8;
3. Check it Create from archetype
and use the maven project template. If there is no corresponding template, you can add archetype
add it. [Note that you can leave the template unchecked, you can choose by yourself, here is the check box as an example] Select the maven-archetype-webapp
create java web template in the template. Click next to enter the next step;
4, in the GroupId
Enter the name of the project team, such as "com.maventest" project team; the ArtifaId
input project name, such as "one" project; the Version
input version number, such as "1.0.0" version. Click next to enter the next step;
5. Select the relevant address of your maven installation configuration (the one that has not been configured before, see the specific configuration: maven configuration ), such as:
Maven home directory:Bundled(Maven 3)
User setting file:D:\Program\Maven\conf\settings.xml
Local repository:D:\Repositories\Maven
Note: At this time, you can click Properties
the +
number on the right to match it archetypeCatalog - internal
; this pair of attribute values can speed up the creation of the project (of course you don’t need to add this). Click next to enter the next step;
6, can Project Name
and Project location
here's the name and location of the configuration items, but generally configured in front of you, here default on it. More settings are generally the default, just keep the same. Click Finish to complete the creation, and then it will automatically install various configured template packages and so on;
7, the common structure and files created Description:
A , .idea
folder configuration information is stored items, including history, version control information. Generally , the project configuration file generated by default that does not need to be concerned with
B.iml
is the intellij idea project configuration file, which contains some configuration information of the current project, such as module information, dependency information, component information, module path, etc. It is a module file created automatically by idea, and generally you don't need to worry about it. But the project name and the .iml file name must be consistent. If they are inconsistent, remember to modify the .iml file name.
C , src
folders, project resource folder is automatically generated after [not their own right to create a new folder on it]. There is usually a main folder and a test folder. The main file generally stores the java source code folder and the resources resource folder. The test folder is mainly for testing according to personal needs. [Larger project, need to build different modules]
D , pom.xml
file used to configure. For example, in the dependency configuration, packaging configuration packaging format, build configuration plug-ins, as well as project version, name, etc. are all fine. [ Query various libraries of maven ]
Note:
idea and .iml can be hidden, by File - settings - Editor - File Types - ignore files and folders
adding ignore files and folders inside.
If you want to change the folder type, you can use two methods:
A. Select the folder that needs to be changed, and then right-click to select Mark Directory As
, for example, you can change to the resource folder.
B. Select the project folder, then right-click to select Open Module Settings
,Modules
It can manage folder types more quickly.
After the Directory folder becomes the Package folder, you can only create a second-level package folder, and you can no longer create ordinary folders in the package folder (the ordinary folders in the idea are generally gray, and the special folders are colored Or different small icons).