【Maven】Maven配置国内镜像

news2024/9/24 3:24:59

文章目录

  • 1. 配置maven的settings.xml文件
    • 1.1. 先把镜像mirror配置好
    • 1.2. 再把仓库配置好
  • 2. 在idea中引用
  • 3. 参考资料

网上配置maven国内镜像的文章很多,为什么选择我,原因是:一次配置得永生、仓库覆盖广、仓库覆盖全面、作者自用的配置。

1. 配置maven的settings.xml文件

1.1. 先把镜像mirror配置好

复制就完事了

<mirrors>
	<mirror>
      <id>aliyun-central</id>
      <!-- 一定不能用*,否则所有的都会被拦截,哪怕在这个仓库找不到依赖 -->
      <mirrorOf>central</mirrorOf>
      <name>aliyun central</name>
      <url>https://maven.aliyun.com/repository/central</url>
    </mirror>

    <mirror>
        <id>repo1</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo1.maven.org/maven2/</url>
    </mirror>

    <mirror>
        <id>repo2</id>
        <mirrorOf>central</mirrorOf>
        <name>Human Readable Name for this Mirror.</name>
        <url>http://repo2.maven.org/maven2/</url>
    </mirror>
</mirrors>

1.2. 再把仓库配置好

复制就完事了

    <profile>
      <!-- 默认的项目编译环境 -->
      <id>jdk1.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>


      <!-- 所有的镜像仓库 -->
      <repositories>
        <repository>
            <id>aliyun-public</id>
            <name>aliyun public</name>
            <url>https://maven.aliyun.com/repository/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-spring</id>
            <name>aliyun spring</name>
            <url>https://maven.aliyun.com/repository/spring</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-spring-plugin</id>
            <name>aliyun spring-plugin</name>
            <url>https://maven.aliyun.com/repository/spring-plugin</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-apache-snapshots</id>
            <name>aliyun apache-snapshots</name>
            <url>https://maven.aliyun.com/repository/apache-snapshots</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-google</id>
            <name>aliyun google</name>
            <url>https://maven.aliyun.com/repository/google</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-gradle-plugin</id>
            <name>aliyun gradle-plugin</name>
            <url>https://maven.aliyun.com/repository/gradle-plugin</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-jcenter</id>
            <name>aliyun jcenter</name>
            <url>https://maven.aliyun.com/repository/jcenter</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-releases</id>
            <name>aliyun releases</name>
            <url>https://maven.aliyun.com/repository/releases</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-snapshots</id>
            <name>aliyun snapshots</name>
            <url>https://maven.aliyun.com/repository/snapshots</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-grails-core</id>
            <name>aliyun grails-core</name>
            <url>https://maven.aliyun.com/repository/grails-core</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>aliyun-mapr-public</id>
            <name>aliyun mapr-public</name>
            <url>https://maven.aliyun.com/repository/mapr-public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
      </repositories>
    </profile>

2. 在idea中引用

如下图在框框处引用你自己的maven本地地址,点击应用点击OK。然后重新刷新您的maven项目看看是不是在下载jar包。

3. 参考资料

idea不自动生成target

Maven配置国内镜像

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/806692.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

matlab使用教程(5)—矩阵定义和基本运算

本博客介绍如何在 MATLAB 中创建矩阵和执行基本矩阵计算。 MATLAB 环境使用矩阵来表示包含以二维网格排列的实数或复数的变量。更广泛而言&#xff0c;数组为向量、矩阵或更高维度的数值网格。MATLAB 中的所有数组都是矩形&#xff0c;在这种意义上沿任何维度的分量向量的长度…

启动Anaconda卡在loading applications的解决办法

启动Anaconda卡在 loading applications的解决办法 问题解决方法 问题 系统环境&#xff1a;macOS BigSur v11.2.2 启动anaconda后&#xff0c;卡在 loading applications界面。 解决方法 在anaconda安装目录下找到conda_api.py文件&#xff0c;将 data yaml.load(f)修改为…

【沐风老师】3dMax子样条线编辑插件SubSpline使用方法详解

3dMax子样条线编辑插件SubSpline&#xff0c;是3dMax中样条曲线形状的高级子对象选择器和材质ID编辑器。 只需一个简单的切换按钮&#xff0c;即可在屏幕上轻松显示所有选定形状的顶点编号和材质ID。 利用箭头工具选择样条曲线子对象&#xff0c;以补充和扩展3dsMax的标准工具…

推荐功能强大的活码管理平台(支持淘宝客和分享卡片)

功能强大的活码管理平台源码-支持淘宝客和分享卡片等功能 演示地址&#xff1a;runruncode.com/code/19494.html 首页 查看群活码、客服码、渠道码当天总访问量查看成员账号个数查看群活码、客服码、渠道码当天各时段访问量 群活码 创建、编辑、删除、分享群活码查看群活码…

使用MyBatis(2)

目录 一、定义接口、实体类、创建XML文件实现接口&#xff09; 二、MyBatis的增删改查 &#x1f345;1、MyBatis传递参数查询 &#x1f388;写法一 &#x1f388;写法二 &#x1f388;两种方式的区别 &#x1f345;2、删除操作 &#x1f345;3、根据id修改用户名 &#x…

推荐带500创作模型的付费创作V2.1.0独立版系统源码

ChatGPT 付费创作系统 V2.1.0 提供最新的对应版本小程序端&#xff0c;上一版本增加了 PC 端绘画功能&#xff0c; 绘画功能采用其他绘画接口 – 意间 AI&#xff0c;本版新增了百度文心一言接口。 后台一些小细节的优化及一些小 BUG 的处理&#xff0c;前端进行了些小细节优…

fasta序列转为数字0和1-python

原始文件&#xff1a; 目标文件&#xff1a; linux版本 #name:lin_convert_fasta_to_01.py #! /usr/bin/env python #usage: python hash-always.py -l 1.list -f 2.txt > out.txt import argparse parser argparse.ArgumentParser(description"Advanced screeni…

训练自己的行文本检测EAST模型

训练自己的行文本检测EAST模型 训练数据格式 训练数据格式

Mybatis初识(一)

一.Mybatis是什么 MyBatis 是一款优秀的持久层框架&#xff0c;它支持自定义SQL、存储过程以及高级映射。MyBatis 去除了几乎所有的JDBC代码以及设置参数和获取结果集的工作。MyBatis 可以通过简单的XML或注解来配置,和映射原始类型、接口和Java POJO (Plain Old Java Objects…

UDS诊断协议

UDS本质上是一系列服务的集合&#xff0c;包含6大类&#xff0c;共26种。每种服务都有独立的ID&#xff0c;即SID。 请求 SID(1Byte) 参数 SID(1Byte) Sub-function(1Byte) 参数 SID DID(2Bytes) 响应 肯定响应 SID0x40(1Byte) Sub-function(根据请求是否存在) 参数…

【C++进阶】继承

⭐博客主页&#xff1a;️CS semi主页 ⭐欢迎关注&#xff1a;点赞收藏留言 ⭐系列专栏&#xff1a;C进阶 ⭐代码仓库&#xff1a;C进阶 家人们更新不易&#xff0c;你们的点赞和关注对我而言十分重要&#xff0c;友友们麻烦多多点赞&#xff0b;关注&#xff0c;你们的支持是我…

收集springboot2.6和2.7新功能新特性,以便后续项目中使用

更多功能看演示系统 gitee源代码地址 后端代码: https://gitee.com/nbacheng/nbcio-boot 前端代码:https://gitee.com/nbacheng/nbcio-vue.git 在线演示(包括H5) : http://122.227.135.243:9888 因为nbcio-boot已经升级到2.7,所以先收集SpringBoot2.6和2.7的新功能,…

数据结构:链表的一些经典的OJ题目

文章目录 写在前面链表OJ调试技巧移除链表元素反转链表链表的中间节点链表中倒数第K个节点链表分割问题 写在前面 本篇为本人学习链表的过程中遇到的典型OJ题&#xff0c;于是整理出来分享思路和便于后续重新学习&#xff0c;每个标题均可跳转至对应习题&#xff0c;大多为Lee…

Autosar通信实战系列02-CAN报文发送周期测试脚本开发及周期不准优化

本文框架 前言1. CAN发送报文的周期测试脚本开发2. 发送报文周期不准的可能原因及优化策略2.1 发送报文的控制逻辑2.2 送报文周期不准的可能原因及优化策略前言 在本系列笔者将结合工作中对通信实战部分的应用经验进一步介绍常用,包括但不限于通信各模块的开发教程,代码逻辑…

nvidia显卡设置 让显卡发挥最大的性能

1、打开官网https://www.nvidia.cn/geforce/drivers/ 查看电脑系统位数和显卡(GPU)的版本 产品系列&#xff1a;Notebooks表示笔记本 2、点击【搜索】-【下载】(game表示游戏驱动)-【下载】 3、双击运行exe文件 4、使用邮箱注册账号时注意要设置正常的年龄 PS设置 1、设置PS使用…

2023 7-29

题目1 删除排序链表重复元素 思路和代码 /*** Definition for singly-linked list.* struct ListNode {* int val;* ListNode *next;* ListNode() : val(0), next(nullptr) {}* ListNode(int x) : val(x), next(nullptr) {}* ListNode(int x, ListNode *n…

某ERP系统信息泄露登录后台

漏洞描述 某ERP前台泄露了某api接口,恶意攻击者可通过调用该接口,对用户的账号和密码进行非授权访问,在获取到账号和密码后,恶意攻击者可接管后台。 免责声明 技术文章仅供参考,任何个人和组织使用网络应当遵守宪法法律,遵守公共秩序,尊重社会公德,不得利用网络从事…

Unity 工具之 NuGetForUnity 包管理器,方便在 Unity 中的进行包管理的简单使用

Unity 工具之 NuGetForUnity 包管理器&#xff0c;方便在 Unity 中的进行包管理的简单使用 目录 Unity 工具之 NuGetForUnity 包管理器&#xff0c;方便在 Unity 中的进行包管理的简单使用 一、简单介绍 二、NuGetForUnity 的下载导入 Unity 三、NuGetForUnity 在 Unity 的…

文件夹加密软件哪个好?文件夹加密软件排行榜

想要加密文件夹&#xff0c;使用专业的文件夹加密软件可以安全有效地加密电脑文件夹。那么&#xff0c;文件夹加密软件哪个好&#xff1f;文件夹加密软件排行榜了解一下。 TOP 1&#xff1a;文件夹加密超级大师 软件亮点&#xff1a;极致安全&#xff0c;5种文件夹加密类型 文…

EMC学习笔记(二十)EMC常用元件简单介绍(二)

EMC常用元件简单介绍&#xff08;二&#xff09; 1.瞬态抑制二极管&#xff08;TVS&#xff09;2.气体放电管3.半导体放电管 电磁兼容性元件是解决电磁干扰发射和电磁敏感度问题的关键,正确选择和使用这些元件是做好电磁兼容性设计的前提。由于每一种电子元件都有它各自的特性,…