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

来源:互联网 发布:linux 强制清空文件 编辑:程序博客网 时间:2024/05/16 07:22
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



0 0
原创粉丝点击