2014年11月14日 星期五

手動 install local lib to local .m2

最近在試著更新我們某個專案使用的第三方 lib,但卻發現在網路上找到的最新版 lib 卻一直無法更新到內部的 repository 上,原因是因為對方(官方)並沒有把最新的釋放出來 (放到官方 repository 上),所以就試著手動將自己下載下來的 lib 安裝進 maven 的目錄,這樣我們專案的 maven 才有辦法抓對我需要的測試 lib。

步驟:
1. 先下載 maven 的手動工具 (不是附在 eclipse 的 plugin) http://maven.apache.org/download.cgi

2. 下載後要做的就是設定 maven 的家 (home) 等相關環境變數。
確定 maven 已經可以在 windows console 下面使用了 --->  mvn --version。

3. 之後則下下列指令,在這邊示範的是要裝新版的 smartgwt-skins.jar
mvn install:install-file -Dfile=C:\Users\evelyn\Downloads\smartgwt-skins.jar -DgroupId=com.smartgwt -DartifactId=smartgwt-skins -Dversion=4.1 -Dpackaging=jar

4. 看到 build success 之後可以去 .m2 下看看應該已經裝好了。

5. 再到 eclipse update pom 就可以使用了。

參考的指令:
mvn install:install-file
-Dfile=<path-to-file>-DgroupId=<group-id>-DartifactId=<artifact-id>-Dversion=<version>-Dpackaging=<packaging>-DgeneratePom=true

Where: <path-to-file>  the path to the file to load
   <group-id>      the group that the file should be registered under
   <artifact-id>   the artifact name for the file
   <version>       the version of the file
   <packaging>     the packaging of the file e.g. jar

沒有留言: