跳到主要內容

Eclipse + Maven 安裝

一般專案裡一定有很多共用的lib,Maven可以方便的幫助使用者統一管理project共用的lib,因最近開發的專案陸續使用Maven的方式管理專案的lib,因此便把maven安裝了,以下安裝步驟

@有關Maven更詳細相關訊息可參考http://maven.apache.org/


1. 下載maven,官方下載網站:http://maven.apache.org/目前最新版本,下載完後解壓縮到電腦裡。

2. 設定環境變數,新增M2_HOME,內容為解壓縮路徑。


3. 在Path裡增加%M2_HOME%\bin,完後切換cmd畫面輸入mvn -version,若成功即顯示maven版本。


4. 開啟在 maven安裝目錄下conf/setting.xml檔,找尋到設置資源庫位置:(localRepository標籤)

Windows 7:

   
    C:\Users\danny.yu\.m2\repository



danny.yu視使用者名稱設定。
若開發環境設置於防火牆下,可嘗試透過 proxy 進行檔案下載:


<settings>
  . . .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  . . .
</settings>


5. 在eclipse 裡安裝 maven :
eclipse => Help => Install New Software => 選擇 m2e 開頭的東西全部安裝




6. 安裝 subclipse:
eclipse => Help => Install New Software =>輸入 http://subclipse.tigris.org/update_1.8.x => 全部安裝

10. eclipse => preferences => maven => installations => add => 擇maven解壓縮位置=>下方 Global settings from installation directory 會變成 解壓縮位置之 settings.xml。
11. eclipse => preferences => maven => User Settings => User Settings =>選擇解壓縮位置之settings.xml,下方之 Local Respository不予更動。



12. 測試:

maven 專案上右鍵=>Run As=>Maven clean,正確結果:[INFO] BUILD SUCCESS 。
maven 專案上右鍵=>Run As=>Maven install,正確結果:[INFO] BUILD SUCCESS。


留言

這個網誌中的熱門文章

初探 Vue 呼叫 API 出現 CORS 跨來源資源共享 問題原因

提要:   在 {初探Vue 與 Spring boot 的對話} 專案 ,前端 Vue 應用程式 串接 後端 API 伺服器 ,axios 呼叫 API 時出現以下,”無法取得回應內容 (No 'Access-Control-Allow-Origin' header is present on the requested resource):” 錯誤訊息,根據查找相關資料 ,出現以下原因。 瀏覽器開發工具 錯誤訊息 畫面 錯誤原因: “ Access to XMLHttpRequest at ” from origin ‘http://localhost:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource” 瀏覽器為了安全考量,實施了同源政策。 當您的前端應用程式 (http://localhost:8080) 嘗試呼叫一個不同來源 (不同協議、不同域名或不同埠號) 的 API 伺服器 (http://localhost:8088) 時,瀏覽器會主動阻止這個請求,除非伺服器明確地允許這個跨來源的存取。 同源政策限制(Same-Origin Policy): 同源政策限制了程式碼和不同網域資源間的互動,同源是指兩份網頁具備相同協定、埠號(如果有指定)以及主機位置 範例: 表列哪些 URL 與 URL http://www.example.com/api/p1 屬於同源: URL                                                   | 結果   | 原因 --------------------------------------------------------------------- http://www.example.com/api/p2     |...

初探 Vue 與 Spring boot 的對話之Frontend (Vue-Frontend)

  Front-end Vue 使用 REST API 建立 Vite 專案 可參考 { Vue 3 初探}  文章 danny@Danny-Yu projects % npm create vite@latest Need to install the following packages: create-vite@8.2.0 Ok to proceed? (y) y > npx > "create-vite" │ ◇   Project name: │   vue-frontend │ ◇   Select a framework: │   Vue │ ◇   Select a variant: │   TypeScript │ ◇   Use rolldown-vite (Experimental)?: │   No │ ◇   Install with npm and start now? │   Yes │ ◇   Scaffolding project in /Users/danny/Desktop/projects/vue-frontend... │ ◇   Installing dependencies with npm... added 47 packages, and audited 48 packages in 27s 6 packages are looking for funding   run `npm fund` for details found 0 vulnerabilities │ ◇   Starting dev server... > vue-frontend@0.0.0 dev > vite   VITE v7.2.4   ready in 411 ms   ➜   Local:   http://localhost:5173/   ➜   Network: use --host to expose   ➜   press h + enter to show...

初探 Spring 中的循環依賴

原因: 當兩個或多個 bean 直接或間接地相互依賴時, 就會出現 Circular Dependency (循環依賴) 如: Bean A -> Bean B -> Bean A import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class BeanA {          @Autowired     private BeanB beanB;     public String sayHi() {         return "Hi! 我是 Class A.";     } } import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class BeanB {          @Autowired     private BeanA beanA;     public String sayHi() {         return "Hi! 我是 Class B.";     } } 編譯時不會出現問題 danny@Danny-Yu demo % mvn clean install -Dmaven.test.skip=true                           ... ... [INFO] Installing /Users/danny/Desktop/projects/demo/target/dem...