> 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：部署檔案。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://brianwu.gitbook.io/brian/brians-za-ji/maven.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
