Maven installation and configuration for mac

Table of contents

1. Download

2. Installation

3. Configure environment variables

4. Verify that the configuration is complete

(5. Configure warehouse and mirror image)


1. Download

Maven – Download Apache Maven

2. Installation

Just unzip

3. Configure environment variables

Open the open ~/.bash_profile file in the terminal and configure the Maven path

Steps for mac to configure environment variables:

  • 1.sudo vim .bash_profile
  • 2.i
  • 3. Enter environment variables
  • 4.esc + :wq!
  • 5.source .bash_profile

Enter the following:

export M2_HOME=/Library/Java/maven/apache-maven-3.5.2(maven的位置)

export PATH=$PATH:$M2_HOME/bin

4. Verify that the configuration is complete

Terminal input: mvn -v

Maven has been configured, if necessary, you can continue

(5. Configure warehouse and mirror image)

Find conf-settings.xml in maven

Configure the warehouse location: the storage location of the jar package

 

<repository>仓库位置</repository>

Configure the mirror: download the warehouse of the jar package, such as:


<mirror>

<id>alimaven</id>

<mirrorOf>central</mirrorOf>

<name>aliyun maven</name>

<url>http://maven.aliyun.com/nexus/content/groups/public/</url>

</mirror>

If you start building from 0, you need to initialize the warehouse and download some necessary plug-ins from the maven warehouse

Execute the maven command: mvn help:system

Guess you like

Origin blog.csdn.net/weixin_60968208/article/details/128952905