mvn仓库镜像配置

1.镜像地址

仓库名称

阿里云仓库地址

源地址

central

https://maven.aliyun.com/repository/central

https://repo1.maven.org/maven2/

jcenter

https://maven.aliyun.com/repository/public

http://jcenter.bintray.com/

public

https://maven.aliyun.com/repository/public

central仓和jcenter仓的聚合仓

google

https://maven.aliyun.com/repository/google

https://maven.google.com/

gradle-plugin

https://maven.aliyun.com/repository/gradle-plugin

https://plugins.gradle.org/m2/

spring

https://maven.aliyun.com/repository/spring

http://repo.spring.io/libs-milestone/

spring-plugin

https://maven.aliyun.com/repository/spring-plugin

http://repo.spring.io/plugins-release/

grails-core

https://maven.aliyun.com/repository/grails-core

https://repo.grails.org/grails/core

apache snapshots

https://maven.aliyun.com/repository/apache-snapshots

https://repository.apache.org/snapshots/

2.修改settings.xml地址和本地仓库地址

3. 修改settings.xml

<?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">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
   -->
   <localRepository>E:/mvnrep/.m2/repository</localRepository>
  <mirrors>
    <mirror>
      <id>mvnrep</id>
      <mirrorOf>*</mirrorOf>
      <name>mvnrep</name>
      <url>https://repo1.maven.org/maven2/</url>
    </mirror>
    <mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
    </mirror>
    <mirror>
      <id>central</id>
      <name>aliyun central</name>
      <url>https://maven.aliyun.com/repository/central</url>
      <mirrorOf>*</mirrorOf>        
    </mirror>
    <mirror>
      <id>aliyunmaven</id>
      <mirrorOf>*</mirrorOf>
      <name>阿里云公共仓库</name>
      <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
  </mirrors>
 
</settings>

需要新增镜像,增加一个   <mirror>即可,url使用阿里云的或者能连上源地址也可以。

4.拉取需要依赖的jar

在你项目的pom.xml里面

增加比如:

    <!--20210805 spring session测试 -->
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
            <version>2.5.1</version>
        </dependency>
        <!--Spring session data redis-->
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-data-redis</artifactId>
            <version>2.5.1</version>
        </dependency>

保存一下,一般就可以自动拉取,或者项目右键Maven-->Update Project,或者使用命令行,

E:\oxygen-workspace\springboot-test-new>mvn clean install -DskipTests

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值