1.镜像地址
仓库名称 | 阿里云仓库地址 | 源地址 |
---|---|---|
central | ||
jcenter | ||
public | central仓和jcenter仓的聚合仓 | |
| ||
gradle-plugin | ||
spring | ||
spring-plugin | ||
grails-core | ||
apache 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