0. JDK installation and configuration
a. In the state of the English input method, press the "Ctrl + Space" key combination on the keyboard to bring up the Spotlight search, where you can quickly start the terminal, enter ter, and press Enter to open the terminal.
b. If you are configuring environment variables for the first time, you can use "touch .bash_profile" to create one. Hidden configuration file for bash_profile (use "open -e .bash_profile" command if you are editing an existing configuration file):
c. Enter the "open -e .bash_profile" command.
d. Enter the following configuration:
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
PATH= JAVA_HOME/bin:JAVA_HOME/bin:JAVAHOME/bin:PATH:.
CLASSPATH= JAVA_HOME/lib/tools.jar : JAVA_HOME/lib/tools.jar: JAVAHOME/lib/tools.jar:JAVA_HOME/lib/dt.jar:
export JAVA_HOME
export PATH
export CLASSPATH
and then save to close the window.
e. Use "source .bash_profile" to make the configuration take effect
f. Enter echo $JAVA_HOME to display the path just configured
g. Verify that jdk is installed java-version
1. Download Maven
Open the official website: https://maven.apache.org/download.cgi
The latest version is prone to problems, it is recommended to download version 3.6.*
Scroll to the bottom of the page and click archives to download the historical version
Recommend these, relatively stable
Follow the picture to choose
After the download is complete, extract it to any directory
2. Configure system environment variables
Open a terminal and type
vim ~/.bash_profile
Press i to enter edit mode
Configured image
M2_HOME=/Users/tools/apache-maven-3.5.3
PATH=$PATH:$M2_HOME/bin
export M2_HOME
After configuration, press esc to exit editing
Then enter : wq to save and close and
then enter source .bash_profile to update the environment variable
source .bash_profile
Notice! After entering mvn -v, the computer will apply for access to the folder where maven is located. Be sure to click Agree. Because I am not familiar with the system, I will not allow it when I install it. , Baidu’s all directly shut down the entire computer permissions, it feels unsafe, just backed up the system before installation, and restarted with the backup system. If anyone knows how to solve this problem, please leave a message below
Re-open a terminal and enter: mvn -v
The display is as follows is success!
If it fails, it will promptcommand not found
3. Configure mirroring
Under the path that maven comes with (due to the wall and so on), the download speed of many of our guide packages may be very slow. In order to get it done once and for all, we directly configure maven with a mirror image to speed up the download.
First, you need to find the apache-maven folder under the configuration path, find the settings.xml file in the /conf folder, open it with a text editor, and configure the Mirror image of Alibaba Cloud.
The specific configuration code is as follows:
<mirror>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirror>
So far, all the configuration of Maven has been completed;