eclipse,idea 安装第三方jar到本地仓库

本文介绍如何通过命令行将第三方jar包手动安装到Maven本地仓库,并更新索引以便IDE能够搜索到该jar包。适用于Eclipse、IntelliJ IDEA等环境。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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。

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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值