JavaWeb (three) - Maven installation, configuration and use of the IDEA

1. Learning Maven reasons

  • In Javaweb development, need to use a lot of jar package, we have to manually import
  • How can I help make a thing automatically import and configure the jar package
    Thus, Maven was born!

2. Maven project management tool architecture

We are currently used is easy to import the jar package !
Maven's core idea: convention than an arrangement that is bound not to violate.
Maven will ordained you how to write our Java code, must be in accordance with the specification;

3. Download and install Maven

Official website: https: //maven.apache.org/
Here Insert Picture Description
Once downloaded, you can extract;

4. Configure Environment Variables

(1) follows in the system environment variables:

  • bin directory under M2_HOME maven directory
  • MAVEN_HOME maven directory
  • Configuring% MAVEN_HOME% \ bin in the path of the system
    Here Insert Picture Description
    Here Insert Picture Description

(2) to test whether the installation was successful Maven
Here Insert Picture Description

5. Ali cloud images

  • Mirroring: mirrors

    • Role: accelerate our downloads
  • Domestic recommended Ali cloud mirrored
    add the following configuration in settings.xml document:

<mirror>
    <id>nexus-aliyun</id>  
    <mirrorOf>*,!jeecg,!jeecg-snapshots</mirrorOf>  
    <name>Nexus aliyun</name>  
    <url>http://maven.aliyun.com/nexus/content/groups/public</url> 
</mirror>

Here Insert Picture Description
Here Insert Picture Description

6. Local Warehouse

(1) Create a folder in the directory maven decompression repository
Here Insert Picture Description
(2) Configuration warehouse address in setting.xml

<localRepository>D:\Environment\apache-maven-3.6.1\repository</localRepository>

Here Insert Picture Description

7. Maven in the IDEA

(1) Start IDEA
(2) create a MavenWeb item
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
(3) wait for the project initialized
first click on the bottom right of the screen Enable Auto-Import automatically imports package
Here Insert Picture Description
this only in the web application will have
Here Insert Picture Description
(4) was observed in more than a maven repository what?
Before the project to create a repository folder is empty, a lot more jar package after creation
Here Insert Picture Description
(5) IDEA in Maven settings
Note: IDEA project is successfully created, look at the Maven configuration
Here Insert Picture Description
Here Insert Picture Description
here, Maven configure and use IDEA in the OK up!

8. Create a regular Maven project

Note: Do not check Create from archetype module, directly next
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

9. Tag folder function

Here Insert Picture Description

(1) The java folder labeled source directory
Here Insert Picture Description

(2) the resources folder is marked as a resource directory
Here Insert Picture Description

Published 62 original articles · won praise 2 · Views 2732

Guess you like

Origin blog.csdn.net/nzzynl95_/article/details/104190506