> For the complete documentation index, see [llms.txt](https://brianwu.gitbook.io/brian/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brianwu.gitbook.io/brian/brians-za-ji/maven.md).

# Maven

## 如何避免到遠端拉取相依套件?

參考資料:(<https://www.javatt.com/p/89342>)

&#x20;mvn -e 顯示詳細錯誤

&#x20;mvn -U 强制更新snapshot類型的插件或依賴庫（否則maven一天只會更新一次snapshot依赖）

&#x20;mvn -o  使用offline模式，不聯網更新依赖

## 建構生命週期（Build lifecycle）

參考資料:(<https://openhome.cc/Gossip/JUnit/BuildLifeCycle.html>)

在Maven中，有三個內建的建構生命週期：Default、Clean與Site。Default處理專案部署，Clean處理專案資源清除，Site處理專案文件。

每個建構生命週期中會再分為數個階段（Phase）

* validate：驗證專案正確性以及所有必要資訊已備妥。
* compil：編譯專案原始碼。
* test：進行單元測試。
* package：將相關檔案進行封裝，例如產生JAR檔案。
* integration-test：進行整合測試。
* verify：驗證檔案封裝是否正確。
* install：將封裝的檔案安裝至本地貯藏室（Local repository）。
* deploy：部署檔案。
