Article Directory
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/
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
(2) to test whether the installation was successful Maven
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>
6. Local Warehouse
(1) Create a folder in the directory maven decompression repository
(2) Configuration warehouse address in setting.xml
<localRepository>D:\Environment\apache-maven-3.6.1\repository</localRepository>
7. Maven in the IDEA
(1) Start IDEA
(2) create a MavenWeb item
(3) wait for the project initialized
first click on the bottom right of the screen Enable Auto-Import automatically imports package
this only in the web application will have
(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
(5) IDEA in Maven settings
Note: IDEA project is successfully created, look at the Maven configuration
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
9. Tag folder function
(1) The java folder labeled source directory
(2) the resources folder is marked as a resource directory