有時候我們開發某個功能可能是自己封裝的jar包,這個時候在maven倉庫是下載不下來的,因此我們需要將要用到的jar包安裝到我們自己的maven倉庫中
如下:(以我需要用到的uxunauth-201808.jar爲例子)
右鍵選中pom.xml文件,run as ---->maven build
在goals中輸入:install:install-file -Dfile=C:\Users\has\Desktop\abc\uxunauth-201808.jar -DgroupId=com.extend -DartifactId=uxunauth -Dversion=1.0.0 -Dpackaging=jar
然後 Apply--->run
Dfile:準備好的jar的路徑
DgroupId:groupid
DartifactId:artifactId
Dversion:version
2.在pom中引入一下
<dependency>
<groupId>com.extend</groupId>
<artifactId>uxunauth</artifactId>
<version>1.0.0</version>
</dependency>
3.大功告成
注意:第二步引入依賴的時候dependency儘量收入讓編譯器提示,不要直接copy,我直接複製會報錯