1 of 7

B3補足1. STS環境構築

STSで開発環境を整える

https://spring.io/blog/2015/03/18/spring-boot-support-in-spring-tool-suite-3-6-4

2 of 7

STSとGradleの準備

STSのインストール

 https://spring.io/tools/sts

Gradle イントール

MACの人はbrew install gradleでインストールしておいてもいいかも

3 of 7

Spring Startar Project作成

File > New

Name: 任意のプロジェクト名

Type: gradleを選択

Depandency:

Web 

4 of 7

ログ出力をコンソールで確認

[sts] -----------------------------------------------------

[sts] Starting Gradle build for the following tasks:

[sts] :cleanEclipse

[sts] :eclipse

[sts] -----------------------------------------------------

:cleanEclipseClasspath UP-TO-DATE

:cleanEclipseJdt UP-TO-DATE

:cleanEclipseProject UP-TO-DATE

:cleanEclipse UP-TO-DATE

:eclipseClasspath

:eclipseJdt

:eclipseProject

:eclipse

BUILD SUCCESSFUL

Total time: 4.917 secs

[sts] -----------------------------------------------------

[sts] Build finished succesfully!

[sts] Time taken: 0 min, 4 sec

[sts] -----------------------------------------------------

5 of 7

こんな感じで作成されました

・メインメソッドがあるクラスが追加されている事を確認

・build.gradleが追加されている事を確認

・application.propertiesが追加されている事を確認

6 of 7

コンソールアプリ用のクラス追加

package demo;

public class ConsoleApplocation {

public static void main(String[] args) {

// TODO Auto-generated method stub

System.out.println("asdfasfa");

}

}

メインメソッドを自動で見つけてくれて選択して実行できる

7 of 7

Gradleの操作

build.gradleを変更した場合に

プロジェクト右クリ

Enable Dependency Management

Refresh Dependency

を実行する