Ubuntu installation Maven steps

First of all, the system I use is Ubuntu16.04 LTS, Sublime for the editor, Maven takes 3.5.0 as an example

The first step, go to the official website to download maven.

Official website download page.png

The second step is to extract to the / opt / maven directory (I installed in this directory)

Create a manve directory.

 

sudo mkdir /opt/maven

Unzip to the / opt / maven directory.

 

sudo tar zxvf apache-maven-3.5.0-bin.tar.gz -C /opt/maven

The third step is to configure the mavne environment.

sudo subl / etc / profile
adds the following content after the file content:

 

export M2_HOME=/opt/maven/apache-maven-3.5.0
export CLASSPATH=$CLASSPATH:$M2_HOME/lib
export PATH=$PATH:$M2_HOME/bin

Save, enter the following command to make the configuration file effective.

 

source /etc/profile

Verify that the installation is successful.

 

mvn -v

The following result appears, indicating successful installation.

 

View maven version effect.png

The fourth step is to modify the maven source to Alibaba Cloud and the default storage path of the warehouse. In this way, Maven will download the jar package much faster.

Open the maven configuration file.

 

sudo subl /opt/maven/apache-maven-3.5.0/conf/settings.xml

If you do not want to modify the default warehouse address, you can skip the next step. Modify according to the following diagram.
1. Generate the maven / repository folder in the / home directory. Note: Please release the comment if the default comment

 

Modify the default warehouse address.png

2. Modify the source (usually Alibaba Cloud).

 

Modify source ... png

Finally, it is best to restart the system or log off to ensure that it is globally available!



Author: Suremotoo
link: https: //www.jianshu.com/p/1b126d810e88
Source: Jane books
are copyrighted by the author. For commercial reproduction, please contact the author for authorization, and for non-commercial reproduction, please indicate the source.

Note: Even if you use the command sudo apt-get install maven to install maven directly, it is best to configure the environment variables to avoid any problems during use. For example, the following error is caused by not configuring the Maven environment.

Published 98 original articles · Like 124 · Visits 40,000+

Guess you like

Origin blog.csdn.net/lyc0424/article/details/105444568