MAVEN シリーズ テキストブック (3) - ウェアハウスのコンセプト、ダウンロード、設定

序文

雌豚のように多産、生き続ける


ヒント: 以下はこの記事の本文であり、次のケースは参考用です。

ステップ 1 : 倉庫コンセプト

いわゆる倉庫は、プロジェクトに必要な瓶パッケージを保管するために使用されます。
Maven は 1 ウェアハウスと複数プロジェクトの方式を採用しており、複数のプロジェクトが 1 つのウェアハウスで同じ jar パッケージを共有できます。

ステップ 2: 倉庫のデフォルトの場所


D:\Java\apache-maven-3.5.0\conf\settings.xmlを開くと、52 行目で指定されたウェアハウスの場所が ${user.home}/.m2/repository であり、私のマシンに対応していること
がわかります。
is d: /canku/repository
個人的には、ウェアハウスを xml のデフォルト パスに置くことはお勧めしません。再インストールすると消えてしまうためです。
覚えておいてください。私と同じように、ウェアハウスを自分の場所に変更し、コメントを解除する必要があります。

<?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>

ステップ 3: Alibaba Cloud ダウンロード パスを使用する

Maven は、デフォルトで Maven が提供する公式サーバーから jar パッケージをダウンロードします。
ただし、公式サーバーが海外にあるため、周知の理由でネットワーク速度が非常に遅く、固まりやすくなります。関連する jar パッケージの迅速なダウンロードを容易にするために、国内 Maven Alibaba Cloud のダウンロード アドレスを使用できます。Alibaba Cloud ダウンロード パスを使用します。
ここに画像の説明を挿入

ステップ 4: 既製の倉庫を使用する

私が現在使用している Maven ウェアハウスは、インターネット上でランダムに見つけたライブラリです。
D:\canku\repositoryに直接ダウンロードして解凍できます。
ここに画像の説明を挿入

おすすめ

転載: blog.csdn.net/dissplay1/article/details/111319938