maven镜像源中下载不到的jar包如何导入

605 阅读1分钟

在做项目的时候发现这种版本较老的依赖无法从阿里云镜像源中下载下来。

Pasted image 20220411182555.png

1. 在maven中央仓库找到自己需要的jar包

maven中央仓库地址:https://mvnrepository.com/

image.png

2. 通过mvn install将本地jar包打到自己的本地仓库

进入自己maven路径的bin目录中,并打开cmd执行以下命令:

mvn install:install-file -Dfile="D:\app\spring-boot-configuration-processor-2.3.6.RELEASE.jar" -DgroupId=org.springframework.boot -DartifactId=spring-boot-configuration-processor -Dversion=2.3.6.RELEASE -Dpackaging=jar

注意将文件路径 -Dfileagv 设置为你自己对应的jar包。

image.png

查看自己本地的仓库是否有此jar包

image.png

这样就打包成功了,可以在 pom.xml 文件中导入项目了!

image.png