maven本地导包到本地仓库

适用情况:

  1、网络不好,导致包下载失败

  2、使用maven私服,包下载失败

方法:

1、在jar包所在的文件夹Shift+鼠标右键

2、命令

运行mvn install:install-file -Dfile=jar包的路径 -DgroupId=gruopId中的内容 -DartifactId=actifactId的内容 -Dversion=version的内容 -Dpackaging=jar

1 <dependency>
2     <groupId>psf</groupId>
3     <artifactId>psf</artifactId>
4     <version>psf-1.3.0_V3.2.00</version>
5 </dependency>

例子:mvn install:install-file -Dfile=psf-psf-1.3.0_V3.2.00.jar -DgroupId=psf -DartifactId=psf -Dversion=psf-1.3.0_V3.2.00 -Dpackaging=jar

3、看到结果有BUILD SUCESS就成功了

可能存在问题:Maven 本地仓库明明有jar包,但是pom文件还是报错

解决:

(1)在eclipse中打开菜单 window-> show view –> other –> Maven -> maven repositories
打开之后,选择local repositories –> local repository ,右击,选择Build index.

(2)重新maven install

原文地址:https://www.cnblogs.com/zhuziyu/p/8869927.html