maven中央仓库,远在国外,没下载,因为网络原因迟迟下载不下来,所以我们就需要配置一些国内的镜像仓库,来进行jar包的下载。但是阿里的仓库并没有收录中央仓库的全部jar包,因此导致我们有些jar包下载不下来,爆红。
整合网络上资料,可以考虑一下几种方法:
1.手动下载中央仓库jar包、导入maven库
比如:我们要下载:
A下载: 访问 :Maven Repository: Search/Browse/Explore (mvnrepository.com)
找对对应包的版本号,点击进行下载。
B下载: 访问: Central Repository: (maven.org)
搜索:
进而找到:com.alibaba.easyexcel.3.0.5 版本。
进行下载。
导入maven仓库:
cmd,在当前jar包目录,进入控制台(我这已经弄好了。)
输入以下指令。
mvn install:install-file -Dfile=easyexcel-3.0.5.jar -DgroupId=com.alibaba -DartifactId=easyexcel -Dversion=3.0.5 -Dpackaging=jar
-Dfile: jar包文件名
-DgroupId: groupId
-DartifactId: artifactId
-Dversion: 版本号
这就是你jar包文件生成的路径。 需要你自己拷贝粘贴到自己的maven仓库。我们就可以正常使用了。
2. 多镜像互补配置
我们的阿里云首当其冲,作为第一镜像,只为代理第一中央仓库。
第二个镜像配置,可以代理所以https:*开头的所有maven仓库。
<mirror>
<id>aliyunmaven</id>
<mirrorOf>central</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:https:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<blocked>true</blocked>
</mirror>
3. 可能遇到的问题。
你的本地jar包有了,但是依然报错? 删除你的IDEA缓存,重启IDEA。