macでgradleを使用したSpringBootによるWebAPIを実行したい

# macでgradleを使用したSpringBootによるWebAPIを実行したい

## 端末情報
```
OS:macOS Mojave
バージョン:10.14.3
端末:MacBook Pro (13-inch,2017,Four Thunderbolt 3 Ports)
プロセッサ:3.1 GHz Intel Core i5
メモリ:8 GB 2133 MHz LPDDR3
```

## 内容一覧
### Gradleインストール
### API実行
### URL確認

## 内容詳細
### Gradleインストール
#### brew Update
```
$ brew update
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Updated 2 taps (homebrew/core and caskroom/cask).
==> New Formulae
allureofthestars       cfn-lint               cubelib                itk                    leela-zero             pipx
boringtun              cpp-gsl                cypher-shell           ktlint                 otf2                   scws
==> Updated Formulae
mysql ✔                     faas-cli                    ipython                     mosquitto                   roll

(...省略...)

restic                      zola
exploitdb                   ios-sim                     mkvtoolnix                  rke
==> Deleted Formulae
imapsync                                                               node@6
```

#### gradle Install(失敗)
```
$ brew install gradle
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: gradle cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc
```
==> gccをインストールするの？、、、

#### gcc Install(失敗)
```
$ brew install gcc
==> Installing dependencies for gcc: gmp, isl, mpfr and libmpc
==> Installing gcc dependency: gmp
==> Downloading https://homebrew.bintray.com/bottles/gmp-6.1.2_2.mojave.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/84/84f74594086bccc53bdb141f4d06d7847680374e255ebe016654da1e47db2dfc?__gda__=exp=1556934978~hm
######################################################################## 100.0%
==> Pouring gmp-6.1.2_2.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/gmp/6.1.2_2: 18 files, 3.1MB
==> Installing gcc dependency: isl
==> Downloading https://homebrew.bintray.com/bottles/isl-0.21.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/f9/f9188b5d486b2a835cd865f219be1a9848ce3926e27089a1538ee989db65447d?__gda__=exp=1556934983~hm
######################################################################## 100.0%
==> Pouring isl-0.21.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/isl/0.21: 72 files, 4.3MB
==> Installing gcc dependency: mpfr
==> Downloading https://homebrew.bintray.com/bottles/mpfr-4.0.2.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/cf/cfce7ab866e98360c9364cd924da620ae7936d3a224d686aacc209c2107d19aa?__gda__=exp=1556934987~hm
######################################################################## 100.0%
==> Pouring mpfr-4.0.2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/mpfr/4.0.2: 28 files, 4.7MB
==> Installing gcc dependency: libmpc
==> Downloading https://homebrew.bintray.com/bottles/libmpc-1.1.0.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libmpc-1.1.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libmpc/1.1.0: 12 files, 354KB
==> Installing gcc
Warning: Building gcc from source:
  The bottle needs the Xcode CLT to be installed.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc
```
==> 失敗、、、以下の記事を発見
[＜1つの解決策:Mac＞CompilerSelectionError: OO cannot be built with any available compilers.](https://qiita.com/zousaaan3/items/d1d9af1bf55c32ca5fe8)

#### xcode-select Install
```
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
```

#### gccインストール
```
$ brew install gcc
==> Downloading https://homebrew.bintray.com/bottles/gcc-8.3.0_2.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/78/78b5b3a98b82f7c89263c5d972a11f01d87a78f70842d889ae9698be57e68f94?__gda__=exp=1556936473~hm
######################################################################## 100.0%
==> Pouring gcc-8.3.0_2.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/gcc/8.3.0_2: 1,414 files, 288.5MB
```

### gradleインストール
```
$ brew install gradle
==> Downloading https://services.gradle.org/distributions/gradle-5.4.1-all.zip
==> Downloading from https://downloads.gradle.org/distributions/gradle-5.4.1-all.zip
######################################################################## 100.0%
🍺  /usr/local/Cellar/gradle/5.4.1: 13,767 files, 235.4MB, built in 3 minutes 22 seconds
```

### gradle Install(確認)
```
$ gradle -v
Welcome to Gradle 5.4.1!

Here are the highlights of this release:
 - Run builds with JDK12
 - New API for Incremental Tasks
 - Updates to native projects, including Swift 5 support

For more details see https://docs.gradle.org/5.4.1/release-notes.html


------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------

Build time:   2019-04-26 08:14:42 UTC
Revision:     261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin:       1.3.21
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          1.8.0_152 (Oracle Corporation 25.152-b16)
OS:           Mac OS X 10.14.3 x86_64
```

### API実行
```
$ java -jar ./build/libs/sample-0.0.1-SNAPSHOT.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.1.1.RELEASE)

INFO  SampleApplication - Starting SampleApplication on seirotauyanoMBP with PID 55437 (/Users/.../@.../11.Program/STS/workspace-3.9.4/spring_boot_part2/build/libs/sample-0.0.1-SNAPSHOT.jar started by tats in /Users/.../@.../11.Program/STS/workspace-3.9.4/spring_boot_part2)
INFO  SampleApplication - No active profile set, falling back to default profiles: default
INFO  TomcatWebServer - Tomcat initialized with port(s): 8080 (http)
INFO  Http11NioProtocol - Initializing ProtocolHandler ["http-nio-8080"]
INFO  StandardService - Starting service [Tomcat]
INFO  StandardEngine - Starting Servlet Engine: Apache Tomcat/9.0.13
INFO  AprLifecycleListener - The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/.../Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
INFO  [/] - Initializing Spring embedded WebApplicationContext
INFO  ContextLoader - Root WebApplicationContext: initialization completed in 1846 ms
INFO  ThreadPoolTaskExecutor - Initializing ExecutorService 'applicationTaskExecutor'
INFO  Http11NioProtocol - Starting ProtocolHandler ["http-nio-8080"]
INFO  NioSelectorPool - Using a shared selector for servlet write/read
INFO  TomcatWebServer - Tomcat started on port(s): 8080 (http) with context path ''
INFO  SampleApplication - Started SampleApplication in 3.158 seconds (JVM running for 4.157)
INFO  [/] - Initializing Spring DispatcherServlet 'dispatcherServlet'
INFO  DispatcherServlet - Initializing Servlet 'dispatcherServlet'
INFO  DispatcherServlet - Completed initialization in 10 ms
```

### URL確認
<img width="408" alt="スクリーンショット 2019-05-04 22.37.49.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/140346/68657662-973c-f9fb-3c96-409881177886.png">

==> なんとか実行確認まで進められました