[Maven] Maven Installation & Getting Started Tutorial Notes

Getting started with Maven (including example tutorials) - Programmer Sought

​​​​​​The most detailed Maven installation tutorial in history_chenxiky's blog-CSDN blog_maven installation tutorial

A brief introduction to Maven:

Maven is a project management and build automation tool that is increasingly used by developers to manage jar packages in projects.

 

Maven installation and configuration:

Download the maven installation package and unzip it:

Maven – Download Apache MavenMaven – Download Apache Maven

New environment variable 

 

maven environment variable configuration. Create a new environment variable MAVEN_HOME, the value is the root directory of Maven, and then add %MAVEN_HOME%\bin to the PATH environment variable;

 

 Verify that the maven environment is successful:

 

 

Set the setting.xml file to configure the local warehouse

Build a maven warehouse in the same directory of maven-3.8.5 (easy to manage)

Find the settings.xml file in maven-3.8.5\conf

Add the repository address outside the comment of localRepositroy

 

Configuring the image, using the domestic Alibaba Cloud image to download dependencies will be much faster

(1) Find the mirrors node in the settings.xml configuration file

 (2) Add the following configuration

 

 <mirror>
    <id>alimaven</id>
    <mirrorOf>central</mirrorOf>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>

Configure jdk:

Find the profiles node in the settings.xml configuration file and add the following configuration

    <profile>
      <id>jdk-1.8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>
      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>        
		<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
    </profile>

When the mvn help:system command is executed for the first time, the Maven related tools automatically help us download the default or updated various configuration files and class libraries (jar packages) from the Maven central warehouse to the Maven central warehouse to the Maven local warehouse.

After downloading various files, the mvn help:system command will print out all Java system properties and environment variables, which are very helpful for our daily programming work.

 

Replenish:

Add Maven to IDEA:

After creating a new maven factory, file-settings->maven, modify the maven main path, set the file and local warehouse. 

Add maven to eclipse

Download the plugin eclipse-maven3-plugin

eclipse-maven3-plugin.zip_Free high-speed download|Baidu network disk-sharing unlimited

After decompression, copy the contents of the corresponding features and plugins files to the same folder of eclipse.

 

 

Then restart eclipse, open window->preferences, you can see a Maven option in an option list.

installations add the root directory.

 maven installation configuration complete

Guess you like

Origin blog.csdn.net/m0_52043808/article/details/124332880