天天看點

maven配置和更新本地庫

  • 一、修改本地庫的儲存位置

    找到 {M2_HOME}\conf\setting.xml, 将 localRepository 标簽中指定内容修改為自定義路徑,如:D:\software\yiibai.com\apache-maven\repository。

<settings><!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  --><localRepository>D:\software\yiibai.com\apache-maven\repository</localRepository>
           

儲存檔案

  • 二、更新本地庫

    執行指令:

執行過程中,由于帶寬或網絡問題的影響,有可能出現以下問題:

maven執行卡在

[INFO] Generating project in Batch mode

處,在原指令後加 -X 參數,打開debug再次運作,發現問題:

[INFO] Generating project in Batch mode
[DEBUG] Searching for remote catalog: 

https://repo.maven.apache.org/maven2/arche
type-catalog.xml
           

帶寬限制導緻下載下傳失敗,此時通過迅雷下載下傳上面連接配接中的XML,并複制到目錄.m2\repository\org\apache\maven\archetype\archetype-catalog\3.0.1下面,然後重新執行下面的指令:

至此更新成功,提示 BUILD SUCCESS,如下圖:

maven配置和更新本地庫

繼續閱讀