mvn编译时绕过本地jar去maven仓库下载问题

第一种解决方法:


构建maven项目时,获取某个jar包,该jar包不在maven中央仓库中,在自己搭建的私服仓库中。本地maven仓库已经存在该jar包,编译时却一直提示,官方maven仓库无法获取到该包。

如下,修改本地maven仓库jar中的_remote.repositories文件进行一些修改即可。具体原因感兴趣的同学可以自行搜索,后续会补充问题的详解。

例如:

#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Wed Jul 05 17:54:08 CST 2017
umpay-v40.pom>local-nexus=
umpay-v40.jar>local-nexus=

修改为:

#NOTE: This is an Aether internal implementation file, its format can be changed without prior notice.
#Wed Jul 05 17:54:08 CST 2017
umpay-v40.pom>central=
umpay-v40.jar>central=
重新编译即可。


第二种解决方法:


把本地仓库的jar 包目录删除掉,使用mvn install 命令,手动install 进仓库。


mvn install:install-file -Dfile=xxx.jar -DgroupId=aaa -DartifactId=bbb -Dversion=1.0.0 -Dpackaging=jar
原文地址:https://www.cnblogs.com/gispathfinder/p/12663430.html