Maven configuration and installation

1. Introduction to Maven

  • Maven is a tool specifically used to manage and build Java projects. Its main functions are:
    • Provides a standardized project structure
    • Provides a set of standardized build processes (compile, test, package, release...)
    • Provides a set of dependency management mechanisms
  1. eclipse, MyEclipse and IntelliJ IDEA have different project structures among different IDEs and are not
    Insert image description here
    universal. Maven provides a set of standardized project structures. The project structures built by all IDEs using Maven are exactly the same. Maven projects created by all IDEs can pass. 2
    . Maven provides a simple set of commands to complete the project build
    Insert image description here
    Insert image description here
    Insert image description here
    Insert image description here

2.Maven installation configuration

  • Unzip apache-maven-3.6.1.rar and the installation is completed
  • Configure the environment variable MAVEN_HOME to be the bin directory of the installation path
  • Configure the local repository: modify <localRepository> in conf/settings.xml to a specified directory
  • Configure Alibaba Cloud private server: Modify the <mirrors> tag in conf/settings.xml and add the following sub-tags to it.
    Insert image description here
    1. Advanced environment variable configuration
    Insert image description here
    2. Add system variables whose value is the installation path of maven
    Insert image description here
    3. Add bin directory
    Insert image description here

3. Configure the local warehouse

The default local warehouse is on the C drive, so we need to configure it

  • Modify conf/settings.xml to a specified directory as a local warehouse to store jar packages
    Insert image description here
  • Configure the Alibaba Cloud private server (because the central warehouse is abroad, downloading jar packages may be slow, and Alibaba provides a remote warehouse, which basically contains jar packages for open source projects). Modify the tags in conf/settings.xml
    , Add the following subtags to it
<mirror> 
	<id>alimaven</id> 
	<name>aliyun maven</name> 		 <url>http://maven.aliyun.com/nexus/content/groups/public/</url> 
	<mirrorOf>central</mirrorOf> 
</mirror>

Insert image description here
The configuration is complete here.

Guess you like

Origin blog.csdn.net/tyloonulinuli/article/details/122776800