Configuration of MAVEN environment variables:
Step 1: Download MAVEN from MAVEN's official website. http://maven.apache.org/download.cgi, what I downloaded here is apache-maven-3.39-bin.tar.gz
Step 2: Decompress the downloaded tar package, I decompress it to: /Users/calvin/Documents/tools/apache-maven-3.3.9.
Step 3: Configure environment variables.
- After using su to be a super administrator, use the command cd ~ to enter the configuration environment variable directory.
- If there is no .bash_profile file in the directory, we use the touch command to create it. For example, touch .bash_profile. Created
- Then we enter into .bash_profile. Use the vim command sh-3.2# vin .bash_profile
- After entering .bash_profile, configure the environment:
MAVEN_HOME:指向我们的maven目标
PATH:执行我们的maven 二进制执行文件的路径
MAVEN_HOME="/Users/daixiaorong/Documents/tools/apache-maven-3.3.9"
PATH=$PATH:$MAVEN_HOME/bin
- After configuration, use the source command to take effect
source .bash_profile - We can check whether the installation is successful through the following command.
(1) Use the echo command to print the path
echo $MAVEN_HOME
(2) Use the mvn -v command to query the version of maven