1 / Turn on the computer, find the terminal command line tool, enter maven environment variable query tool;
mvn -v
After 2 / executing the command, two reminders are not installed at this time, when a command is not mvn, without mounting a maven. Execute the following command to start the download maven:
$ Curl -The http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
After the download is complete, the mac download below the default; execute the following command to start unpacking:
$ Tar -xvf apache-maven-3.3.9-bin.tar.gz
After unpacking completes, install and execute the command to delete the source files:
$ sudo mv -f apache-maven-3.3.9 /usr/local/
Use the sudo command to perform the installation, the installation directory via the / usr / local /
3 / set environment variables, execute the following command to edit the file open,
sudo vim /etc/profile
Use the sudo command, vim to open the file profile, then the time should be an empty file if you have not had any mac software installation; add the following code at the end of the file, which is similar to Windows, set environment variables
export MAVEN_HOME=/usr/local/apache-maven-3.3.9 export PATH=${PATH}:${MAVEN_HOME}/bin
After entering the settings, run the following command to save the file, and makes the command set in force:
$ source /etc/profile
4 / entering a query command mvn -v, check whether the installation was successful, success will prompt the following information:
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00) Maven home: /usr/local/apache-maven-3.3.9 Java version: 1.8.0_221, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "mac os x", version: "10.14.5", arch: "x86_64", family: "mac"
During development, you need to download the maven jar file, do not use the default settings set here, if you do not mind, can see step 4, the following can not see.
5 / configuration settings in the file storage jar files and source files to download location
Run the following commands, entered maven installation directory, which is performed after step 2;
cd /usr/local/apache-maven-3.3.9/conf/
Enter the installation path following configuration folder, use the ls command to view a list of files in the current folder below, such as the list of files to show me after the ls as follows:
logging settings.xml toolchains.xml
Settings.xml command execution command to open, edit settings:
vim settings.xml
Locate the following tags (default here is to use the default configuration, has been commented out)
<localRepository></localRepository>
Copy the current line, add a tag like this below right, property value path /usr/local/apache-maven-3.3.9/resp,resp this folder to be created in advance, so each download file is downloaded here.
Currently used to command
'' Create Folder command sudo mkdir folder name '' execute vim manipulate files vim file name '' entered vim command line input, paste, copy mode i '' exit vim command line view mode esc '' execute commands, make the mouse cursor point to the end of the file : '' the following command sequence is: vim exit the command, vim save command, vim save and exit command, vim and forced to quit without saving command : q : w : WQ : q!