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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM