Macにgradleをインストールするための個人的な備忘録。
毎回忘れてjarをインストールするのって大変だなぁと思ってしまうので。
updateをかける
$ brew update
なんかエラーでるので、書かれたとおりにuntapしていく
$ brew untap homebrew/homebrew-dupes
$ brew untap homebrew/homebrew-x11
gradleをインストール
$ brew install gradle
ついでにメンテナンス
$ brew cleanup
目的のディレクトリまで移動
build.gradleなどが入っているディレクトリまで移動
初期処理
$ gradle
こんなのがでる
Welcome to Gradle 5.4!
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/release-notes.html
Starting a Gradle Daemon (subsequent builds will be faster)
> Task :help
Welcome to Gradle 5.4.
To run a build, run gradle ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
To see more detail about a task, run gradle help --task
For troubleshooting, visit https://help.gradle.org
BUILD SUCCESSFUL in 12s
1 actionable task: 1 executed
タスクの確認(しなくてもいい)
$ gradle tasks
> Task :tasks
------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------
Build tasks
-----------
assemble - Assembles the outputs of this project.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.
Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.
Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.
Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'ArtNet for Java'.
components - Displays the components produced by root project 'ArtNet for Java'. [incubating]
dependencies - Displays all dependencies declared in root project 'ArtNet for Java'.
dependencyInsight - Displays the insight into a specific dependency in root project 'ArtNet for Java'.
dependentComponents - Displays the dependent components of components in root project 'ArtNet for Java'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'ArtNet for Java'. [incubating]
projects - Displays the sub-projects of root project 'ArtNet for Java'.
properties - Displays the properties of root project 'ArtNet for Java'.
tasks - Displays the tasks runnable from root project 'ArtNet for Java'.
Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.
Rules
-----
Pattern: clean: Cleans the output files of a task.
Pattern: build: Assembles the artifacts of a configuration.
Pattern: upload: Assembles and uploads the artifacts belonging to a configuration.
To see all tasks and more detail, run gradle tasks --all
To see more detail about a task, run gradle help --task
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
buildする
$ gradle build
BUILD SUCCESSFUL in 21s
4 actionable tasks: 4 executed
成功すると、build/libsディレクトリにjarファイルが生成される。
幸せ。