1. 安装第三方jar到我们的本地库中
进入cmd,F:\java_memcached-release_2.6.6>mvn install:install-file -Dfile=java_memcached-release_2.6.6.jar -DgroupId=com.dana -DartifactId=memcached -Dversion=2.6.6 -Dpackaging=jar -DgeneratePom=true
2.重建索引:
重建maven本地库(Repository)索引index( window->show View->other->Maven->Meven Repositorise点击 OK 然后在视图中 点击localRepositorise右键Rubuild Index)
其实这一步相当于让maven重新对本地的Responsitory中的jar建立索引,以让我们搜索包的时候可以搜索到我们最新安装的jar。
2.重建索引:
重建maven本地库(Repository)索引index( window->show View->other->Maven->Meven Repositorise点击 OK 然后在视图中 点击localRepositorise右键Rubuild Index)
其实这一步相当于让maven重新对本地的Responsitory中的jar建立索引,以让我们搜索包的时候可以搜索到我们最新安装的jar。
idea:
idea要想能从本地maven库搜索到手动添加的jar,可以settings/maven/repositories/点击对应URL的update按钮
eclipse:
windows/show view/maven repositories/Local Repository 右击进行重新建索引
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3.安装到指定仓库需要指定-DlocalRepositoryPath:
mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=path-to-your-artifact-jar \
-DgroupId=your.groupId \
-DartifactId=your-artifactId \
-Dversion=version \
-Dpackaging=jar \
-DlocalRepositoryPath=path-to-specific-local-repo
详细见:https://maven.apache.org/plugins/maven-install-plugin/examples/specific-local-repo.html
本文介绍如何通过命令行将第三方jar包手动安装到Maven本地仓库,并更新索引以便IDE能够搜索到该jar包。适用于Eclipse、IntelliJ IDEA等环境。
6536

被折叠的 条评论
为什么被折叠?



