MAVEN Series Textbook (3) - Warehouse Concept, Download and Configuration

foreword

High-yielding like a sow, continue to live


Tip: The following is the text of this article, and the following cases are for reference

Step 1 : Warehouse Concept

The so-called warehouse is used to store the jar packages required by the project.
Maven adopts the method of one warehouse and multiple projects, allowing multiple projects to share the same jar package in one warehouse.

Step 2: Warehouse default location

Open
D:\Java\apache-maven-3.5.0\conf\settings.xml
and you can see that the location of the warehouse specified on line 52 is ${user.home}/.m2/repository,
corresponding to my machine is d: /canku/repository
Personally do not recommend putting the warehouse in the default path of xml, because it will be gone after reinstalling.
Remember, you must change it to your own warehouse location and uncomment it, like me

<?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -s /path/to/user/settings.xml
 |
 |  2. Global Level. This settings.xml file provides configuration for all Maven
 |                 users on a machine (assuming they're all using the same Maven
 |                 installation). It's normally provided in
 |                 ${maven.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are intended to give you a running start at
 | getting the most out of your Maven installation. Where appropriate, the default
 | values (values used when the setting is not specified) are provided.
 |
 |-->
<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">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  -->
 <localRepository>d:/canku/repository</localRepository>

Step 3: Use the Alibaba Cloud download path

maven will download the jar package from the official server provided by maven by default.
However, the official server is located abroad. For reasons known to everyone, the network speed is very slow and it is easy to get stuck. In order to facilitate the quick download of related jar packages, you can use the download address of the domestic maven Alibaba Cloud: use the Alibaba Cloud download path
insert image description here

Step 4: Use an off-the-shelf warehouse

The maven warehouse I am currently using is a library I found randomly on the Internet. It can be directly downloaded and decompressed in
D:\canku\repository
insert image description here

Guess you like

Origin blog.csdn.net/dissplay1/article/details/111319938