maven项目如何引用本地的jar包

  1. 下载该jar包到本地(如下载目录结构为:D:\Users\lu.wang\Downloads\searchservice\searchservice\jar\ttd.search.searchservice.jar)
  2. 安装jar到本地maven仓库 cmd中敲入命令:
    mvn install:install-file -Dfile=D:\Users\lu.wang\Downloads\searchservice\searchservice\jar\ttd.search.searchservice.jar -DgroupId=searchservice -DartifactId=searchservice -Dversion=1.0.0 -Dpackaging=jar (-Dfile: 要安装的jar的路径; -DgroupId:pom.xml中的groupId,会生成安装路径; -DartifactId:pom.xml中的artifactId,会生成安装路径; -Dversion:对应pom.xml中的version,jar的版本
  3. 安装成功后,会在本地maven仓库中找到如下路径(如:D:\Users\lu.wang\.m2\repository\searchservice\searchservice)
  4. 在要引用该jar的maven项目的pom.xml里添加该jar依赖
    <dependency>     <groupId>searchservice </groupId>     <artifactId>searchservice </artifactId>     <version>1.0.0</version> </dependency>
posted @ 2016-08-09 10:10  青春暮年  阅读(3746)  评论(0编辑  收藏  举报