Ubuntu - download, configure Maven

Ubuntu - download, configure Maven

Environmental Information

Ubuntu system information:

$ lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

IDE version information:

Spring Tool Suite 4 
Version: 4.5.1.RELEASE
Build Id: 202001211336
OS: Linux, v.5.3.0-28-generic, x86_64 / gtk 3.22.30
Java version: 1.8.0_241

Download and unzip Maven

Apache Maven visit the official website, download Maven:
Here Insert Picture Description

Click on the link to download the check back Checksum, and view files:

c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0

Calculate file checksum

After the download is complete, enter the directory where the file:

$ ll
total 9292
drwxr-xr-x  2 mk mk    4096 2月   8 09:27 ./
drwxr-xr-x 29 mk mk    4096 2月   8 09:23 ../
-rw-rw-r--  1 mk mk 9506321 2月   8 08:48 apache-maven-3.6.3-bin.tar.gz

SHA512 checksum calculation and file:

$ sha512sum apache-maven-3.6.3-bin.tar.gz 
c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0  apache-maven-3.6.3-bin.tar.gz

If the checksum calculation is consistent with the official website provides obtained instructions to download files without problems.

unzip files

$ tar -zxvf apache-maven-3.6.3-bin.tar.gz

Configuring Maven in the Spring Tool Suite 4

Start STS, click on the menu Window> Preferences; in the Preferences window, select Maven> Installation, and then click the Add button on the right:
Here Insert Picture Description

In New Maven Runtime window, click on the back Installation home of Directory ... button to set Maven installation directory, and click the Finish button:
Here Insert Picture Description

Back to the Preferences window, Maven Installations page, select Maven us to configure, and then click the Apply button at the bottom right:
Here Insert Picture Description

Next, select Maven> User Settings page, click one behind the User Settings Browse ... button:
Here Insert Picture Description

Maven load profiles:
Here Insert Picture Description
When finished, click one behind the User Settings open file, edit the configuration file, the new configuration 3:

  1. Local Maven repository
  2. Ali cloud using Maven repository mirroring provided
  3. JDK version
  4. Other configurations remain the same
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  
  <!-- 本地 Maven 仓库 -->
  <localRepository>/home/mk/Documents/Java/Apache/Maven/mvnrepository</localRepository>

  <mirrors>
    <!-- 使用阿里云提供的 Maven 仓库镜像 -->
    <mirror>
      <id>alimaven</id>
      <name>aliyunmaven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>
  </mirrors>
  
  <profiles>
    <!-- JDK 版本 -->
    <profile>
      <id>jdk-1.8</id>
	  <activation>
	    <activeByDefault>true</activeByDefault>
	    <jdk>1.8</jdk>
	  </activation>
	  <properties>
	    <maven.compiler.source>1.8</maven.compiler.source>
          <maven.compiler.target>1.8</maven.compiler.target>
	      <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
	</profile>
  </profiles>
</settings>

After configuration is complete, re-open the Preferences, in the Maven> User Settings page, you can see just configured local repository (Local Repository) has entered into force:
Here Insert Picture Description

When we introduced the new Maven project and dependent on, downloaded from a remote Maven central repository depend on the preservation of the local repository:
Here Insert Picture Description

Published 55 original articles · won praise 0 · Views 3173

Guess you like

Origin blog.csdn.net/qq_29761395/article/details/104224005