內容目錄
Spring Boot 在 Eclipse 的安裝與設定
這是開發程式歷程中主要的重要提示,並不會有 Step by Step 的說明,因此您需要有基本的 Java 與網頁撰寫的能力。程式的「版本控制」 說明可以參考: 程式版本控制 on GitHub or Gitee or Bitbucket or GitLab 。
下載軟體:
2021年01月更新
- Java – https://jdk.java.net/15 : OpenJDK15GA
- Gradle – Gradle 6.8
- IDE – https://www.eclipse.org/downloads/packages : Eclipse 2020-12
- Lombok – Download 1.18.16 (https://projectlombok.org/download.html)
- Spring Boot 2.4 now fully supports (and is tested against) Java 15. The minimum supported version remains Java 8.
2020年以前
- Java – OpenJDK: https://developers.redhat.com/products/openjdk/download
- IDE – Eclipse: https://www.eclipse.org/downloads/
- Version Control in Cloud :
– GitHub
– Bitbucket
– Gitee
– GitLab - Web Page Layout – AdminLTE3: https://github.com/ColorlibHQ/AdminLTE/releases
- Git Tool: https://git-scm.com/download/win
安裝
將檔案放在 d:\progs ,並利用 windows 的指令 subst 來虛擬磁碟機,以簡化目錄路徑長度及日後開發電腦更換時重新設定的不便。
subst v: d:\Progs
- 解壓檔案: openjdk-15.0.1_windows-x64_bin.zip 於 V:\Openjdk\jdk-15.0.1
- 解壓檔案: eclipse-jee-2020-12-R-win32-x86_64.zip 於 v:\eclipse-202012
- Lombok setup on Eclipse 安裝請參考: Eclipse 安装 lombok – 讓撰寫 JAVA 程式更加優雅簡潔
- 解壓檔案: gradle-6.8-all.zip 於 V:\gradle\gradle-6.8 , release-notes:
Upgrade instructions Switch your build to use Gradle 6.8 by updating your wrapper: ./gradlew wrapper --gradle-version=6.8
建立一個 eclipse-202012-openjdk.bat 的啟動檔,內容如下:
set JAVA_HOME=V:\Openjdk\jdk-15.0.1 set PATH=.;%JAVA_HOME%\jre\bin;%JAVA_HOME%\bin;V:\gradle\gradle-6.8\bin; V:\eclipse-202012\eclipse.exe -nl en
這樣開發環境大致上就可以使用了 😀
建議的 eclipse plugins
下列的 plugin 是讓開發的過程中比較方便,可以參考看看。
- DBeaver : DBeaver is free universal SQL client/database tool for developers and database administrators. It can work with any database server which has JDBC or ODBC driver…
- JBoss Tools : JBoss Tools is an umbrella project for a set of Eclipse plugins that includes support for JBoss and related technologies, such as Hibernate, JBoss AS / WildFly, CDI, OpenShift, Apache Camel, Red Hat JBoss Fuse, Docker, JSF, (X)HTML, Maven, and more.
- Spring Tools 4 : Spring Tools 4 is the next generation of Spring tooling for your favorite coding enrivonment. Largely rebuilt from scratch, it provides world-class support for developing Spring-Boot-based enterprise applications, whether you prefer Eclipse, Visual Studio Code, or Atom IDE.
- ResourceBundle Editor : Lets you manage all localized .properties files in one screen. Some features: sorted keys, warning icons on missing keys/values, conversion to/from Unicode, hierarchical view of keys, and more.
Eclipse 執行速度問題
若 Eclipse 執行一段時間後,速度愈來愈慢時,可以考慮的作法如:建立一個批次檔案:SpeedUpEclipse.bat 放在 eclipse 相同的工作目錄下( 如:V:\eclipse-201903-workspace ),檔案內容如下:
RMDIR /Q/S ".\.metadata\.plugins\org.eclipse.jdt.core\" ".\.metadata\.plugins\org.eclipse.core.resources\.history\" pause
查看 Spring boot JAR檔的原始碼
若在 Eclipse 使用 Gradle 建立的專案中,想要查看 Spring boot JAR檔的原始碼,可以在 build.gradle
裡加入下列參數
apply plugin: 'java' apply plugin: 'eclipse' // 下載 JAR 原始碼 eclipse { classpath { downloadJavadoc = true downloadSources = true } } // 在這個段落中你可以聲明原始檔案和目標編譯後的Java版本相容性 sourceCompatibility = 15 targetCompatibility = 15
你必須 登入 才能發表評論。