12.4. STS4の設定手順¶
なお、以降の解説はJava、Maven及びアプリケーションサーバーがインストールされていることを前提としている。これらのインストール手順については各自で調査されたい。
12.4.1. Spring Tool Suite 4とは¶
12.4.2. STS4の導入手順¶
12.4.2.1. STS4の導入¶
なお、以下で紹介する導入手順はWindowsを前提としているため注意されたい。
ダウンロードした「spring-tool-suite-4-4.x.x.RELEASE-e4.xx.x-win32.win32.x86_64.self-extracting.jar」を以下のどちらかの手順で実行すると、ダウンロードしたファイルが配置されているフォルダにSTS4が展開される。
ダウンロードした「spring-tool-suite-4-4.x.x.RELEASE-e4.xx.x-win32.win32.x86_64.self-extracting.jar」をダブルクリック
コマンドラインから
java -jar spring-tool-suite-4-4.x.x.RELEASE-e4.xx.x-win32.win32.x86_64.self-extracting.jar
を実行する。
展開完了後、展開されたフォルダ内の「SpringToolSuite4.exe」を実行することでSTSを起動することができる。
12.4.2.2. プラグインの導入¶
Eclipse Enterprise Java and Web Developer Tools
Webアプリ開発用のプラグイン(WTP)やJSPエディタを使用するために必要なプラグイン。

Spring Tools 3 Add-On for Spring Tools 4
xml形式のbean定義ファイルをサポートするためのプラグイン。STS4に入っているプラグインと一部の機能が競合するためそのままではインストールできないため、「Update my installation to be compatible with the items being installed」にチェックを入れて互換性を持たせた状態でインストールを行う。

Note
STS 4.17.1.RELEASEに対しSpring Tools 3 Add-On for Spring Tools 4をインストールする際に、以下の様なエラーが発生することを確認している。
Cannot complete the install because one or more required items could not be found. Software being installed: Spring IDE Integration, Flex and Web Services Extension (optional) 3.9.22.202204280911-RELEASE (org.springframework.ide.eclipse.integration.feature.feature.group 3.9.22.202204280911-RELEASE) Missing requirement: Spring IDE Configuration Graphical Editing 3.9.22.202204280911-RELEASE (org.springframework.ide.eclipse.config.graph 3.9.22.202204280911-RELEASE) requires 'osgi.bundle; org.eclipse.mylyn.commons.ui [3.7.0,4.0.0)' but it could not be found Cannot satisfy dependency: From: Spring IDE Core (required) 3.9.22.202204280911-RELEASE (org.springframework.ide.eclipse.feature.feature.group 3.9.22.202204280911-RELEASE) To: org.eclipse.equinox.p2.iu; org.springframework.ide.eclipse.config.graph [3.9.22.202204280911-RELEASE,3.9.22.202204280911-RELEASE] Cannot satisfy dependency: From: Spring IDE Integration, Flex and Web Services Extension (optional) 3.9.22.202204280911-RELEASE (org.springframework.ide.eclipse.integration.feature.feature.group 3.9.22.202204280911-RELEASE) To: org.eclipse.equinox.p2.iu; org.springframework.ide.eclipse.feature.feature.group 0.0.0
これは、Eclipse IDEからEclipse Mylyn Task UIが削除されたことが原因であるため、個別にMylynをインストールする必要がある。
Note
ビルド時にJSPファイルで以下のエラーが発生する場合がある。
The superclass "javax.servlet.http.HttpServlet", determined from the Dynamic Web Module facet version (2.5), was not found on the Java Build Path
この状態は、Dynamic Web Moduleのバージョンをあげることで解消できる。
プロジェクト名を右クリックし、「Properties」を選択 ->「Project Facets」の「Dynamic Web Module」を5.0へ変更することで解決する。

Note
プロキシ環境下でプラグインを導入する場合、プロキシ設定を行わないとEclipse MarketPlaceに接続できずプラグインを導入することができない。
プロキシ設定は以下の手順で行える。
STSのメニューから、Window > Preferences > General > Network Connections からプロキシ設定を開き、Active ProviderをManualにしてHTTPとHTTPSにプロキシを設定する。

12.4.3. 作業用の事前設定¶
12.4.3.1. JavaScriptのエディタ設定¶
STSのメニューから、Help > Install New Softwareを選択し、Work withに「
https://download.eclipse.org/releases/latest/
」を入力する。Web,XML,Java EE and OSGi Enterprise Development > JavaScript Development Tools を選択し、インストールを行う。

Note
JSDTのインストール後、再起動を行うことで自動的に.jsファイルをJavaScript Editorで開くようになる。自動的に切り替わらない場合は、STSのメニューから、Window > Preferences > General > Editors > File Associations を開き、*.jsファイルに対してJavaScript Editorを関連付ける。
12.4.3.2. Perspective設定¶
12.4.3.3. Java設定¶
STSのメニューから、Window > Preferences > Java > Installed JREs を開き、予め用意したJDKにチェックがついていることを確認する。
用意したJDKが一覧に存在しない場合は AddからStandard VMを選択し、Directoryから用意したJDKを選択し追加する。

12.4.3.4. Maven設定¶
Window > Preferences > Maven > Installations からAddを選択し、Directoryから用意したMavenを選択し追加する。

12.4.3.5. Server設定¶
Serverビューを右クリックし、New > Serverを選択する。
Apache配下から使用しているTomcatのバージョンと一致するTomcatを選択しNextを押下する。
Browseから事前にインストールしておいたtomcatを選択し、Finishを押下する。
サーバにアプリケーションを設定したい場合は、追加したサーバを右クリックしてAdd and Removeを選択する。表示された画面のAvailableにある動作させたいアプリケーションを選択し、AddでConfiguredに追加してFinishを押下する。
アプリケーションを設定したサーバを右クリックし、Startを選択してサーバを起動する。
