Maven
Introduce
In the development process of JavaWeb, we need to use a large number of jar packages to help us realize various business functions, but manual import is extremely cumbersome, so is there anything that can realize automatic import of these jar packages and free our hands ? At this time a tool called Maven appeared.
Overview
Maven is a pure Java development open source project under Apache; it is a project management tool that can build and depend on Java projects; Maven can also be used to build and manage projects written in other languages, such as C#.
Core idea: Conventions are greater than configuration . Because many Java-written specifications are constrained in Maven, the conventions must be strictly followed when using Maven.
Installation configuration
download
- First go to the official website to download the appropriate tarball
- Unzip and get the following file
Configure environment variables
Add the following configuration to the system environment variables:
- Variable name: M2_HOME Variable value: bin directory under maven
- Variable name: MAVEN_HOME Variable value: maven root directory
- Add under path: %MAVEN_HOME%\bin
Then execute the mvn -v command under cmd to see if the configuration is successful:
Configure Alibaba Cloud image
Since the Maven remote warehouse is abroad and the domestic IP access speed is limited, the Alibaba Cloud domestic mirror warehouse is used.
-
In the conf directory, find the settings.xml configuration file
-
In <mirrors> Fill the tag follows:
<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>
Configure local warehouse
- Create a new folder maven_warehouse in the maven directory
-
Find the following code in the settings.xml configuration file:
<localRepository>/path/to/local/repo</localRepository>
- Copy it outside the comment, and edit the content inside to be the directory address you just created.