タイトル通り。macOS Mojave 10.14.6、Docker 19.03.5で動作確認しました。
以下のコマンドを実行します。
docker run -it --rm -v `pwd`:/home/gradle gradle:5.6-jdk11 gradle init
すると以下のように色々と選択肢が現れるので、必要のものを選択するだけです。
Welcome to Gradle 5.6.4! Here are the highlights of this release: - Incremental Groovy compilation - Groovy compile avoidance - Test fixtures for Java projects - Manage plugin versions via settings script For more details see https://docs.gradle.org/5.6.4/release-notes.html Starting a Gradle Daemon (subsequent builds will be faster) Select type of project to generate: 1: basic 2: application 3: library 4: Gradle plugin Enter selection (default: basic) [1..4] 2 Select implementation language: 1: C++ 2: Groovy 3: Java 4: Kotlin 5: Swift Enter selection (default: Java) [1..5] 3 Select build script DSL: 1: Groovy 2: Kotlin Enter selection (default: Groovy) [1..2] 1 Select test framework: 1: JUnit 4 2: TestNG 3: Spock 4: JUnit Jupiter Enter selection (default: JUnit 4) [1..4] 4 Project name (default: gradle): sample_app Source package (default: sample_app): > Task :init Get more help with your project: https://docs.gradle.org/5.6.4/userguide/tutorial_java_projects.html BUILD SUCCESSFUL in 29s 2 actionable tasks: 2 executed
これでカレントディレクトリにGradleで生成された初期ファイル群が生成されます。
$ ls -l total 40 -rw-r--r-- 1 miyohide staff 929 11 22 13:41 build.gradle drwxr-xr-x 3 miyohide staff 96 11 22 13:40 gradle -rwxr-xr-x 1 miyohide staff 5960 11 22 13:40 gradlew -rw-r--r-- 1 miyohide staff 2942 11 22 13:40 gradlew.bat -rw-r--r-- 1 miyohide staff 355 11 22 13:41 settings.gradle drwxr-xr-x 4 miyohide staff 128 11 22 13:41 src