【Share】Mac for Maven installation and configuration

15705116:

Introduction to Maven:

Maven is a project management tool that can automate the construction and dependency management of Java projects.
Maven can be seen as an accumulator of knowledge, originally created to simplify the build process in the Jakarta Turbine project. There are several projects, each with its own Ant build file, which are all slightly different. JARs are checked into CVS. We wanted a standard way to build projects, a clearly defined project composition, an easy way to publish project information, and a way to share JARs between multiple projects.

The result is a tool that can now be used to build and manage any Java-based project. We hope we've created something that makes the day-to-day work of Java developers easier and generally helps in understanding any Java-based project.

Maven official website
insert image description here
Maven Chinese official website

insert image description here


mavendownload

Method 1: Download the compressed package from the official website

Maven official website download
insert image description here
historical version download
insert image description here

Method 2: brew one-click installation

One-click installation of Maven and configuration of environment variables, the default installation is in/usr/local/Cellar/maven

brew install maven

Maven modifies the Ali source warehouse:

Modify: /maven/conf/settings.xml使用brew安装配置路径:/usr/local/Cellar/maven/3.8.3/libexec/conf

Copy the following configuration

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

insert image description here


Maven modifies the local file storage path: (non-essential steps)

Find the <localRepository code block, which is commented by default

  <localRepository>/user/local/maven/repository</localRepository>

insert image description here


Maven modifies environment variables (brew installation can be ignored)

1. Switch to the root directory first. If you are configuring environment variables for the first time, you need to create a .bash_profile file

cd ~
touch .bash_profile

2. Edit the .bash_profile file and add the following configuration

MAVEN_HOME is your Maven installation path

vi .bash_profile

export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=mavenhome/bin:PATH

3. Update the configuration file

source .bash_profile

4. Query the version number of maven

mvn -v

insert image description here

Guess you like

Origin blog.csdn.net/weixin_42380504/article/details/128896335