0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Gradle のことはじめ

0
Posted at

はじめに

gradle のインストール

まずは、 chocolatey をインストールする。
以下のインストールのページにある PowerShell を実行する。
https://chocolatey.org/install

管理者モードで PowerShell ターミナルで以下のコマンドを実行。

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

chocolatey のインストールが終われば、そのまま PowerShell のターミナルで以下のコマンドを実行

choco install gradle -y

gradle プロジェクトの作成

プロジェクト用のディレクトリ作成

>mkdir sample-gradle-project

ディレクトリで gralde プロジェクトを作成

>cd sample-gradle-project

D:\github\program\sample-gradle-project>gradle init

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: Scala
  6: Swift
Enter selection (default: Java) [1..6] 3

Split functionality across multiple subprojects?:
  1: no - only one application project
  2: yes - application and library projects
Enter selection (default: no - only one application project) [1..2] 2

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2] 1

Project name (default: sample-gradle-project):
Source package (default: sample.gradle.project):

> Task :init
Get more help with your project: https://docs.gradle.org/7.0/samples/sample_building_java_applications_multi_project.html

BUILD SUCCESSFUL in 3m 14s
2 actionable tasks: 2 executed

D:\github\program\sample-gradle-project>

Gradle でビルド

以下のコマンドでビルドする。ビルドすると、「app\build\distributions」に zip, tar ファイルができる。

D:\github\program\sample-gradle-project>gradle build

BUILD SUCCESSFUL in 26s
13 actionable tasks: 13 executed

実行

Windows で「app\build\distributions」にある zip ファイルを展開するとバッチファイルを実行する

> cd D:\github\program\sample-gradle-project\app\build\distributions
> unip app.zip
> cd D:\github\program\sample-gradle-project\app\build\distributions\app\bin
> app.bat
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?