Groovy & Gradle: JVM Automation and Build Engineering · レッスン

GradleのインストールとCLI

Gradleをインストールし、コマンドラインインターフェースを理解して、基本的なビルドコマンドを実行します。

レッスン 1/411 ステップ

「GradleのインストールとCLI」はCoddyKit上の無料Groovy & Gradle: JVM Automation and Build Engineeringレッスンです。 これはレッスン1/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはGroovy & Gradle: JVM Automation and Build Engineering学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Groovy & Gradle: JVM Automation and Build Engineeringコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

Meet the Gradle CLI

The Gradle Command Line Interface (CLI) is your main tool for interacting with Gradle. It's how you tell Gradle what to do, like building your project or running tests.

Understanding the CLI is crucial for automating your build processes and managing your projects effectively.

Java is Required!

Before installing Gradle, you need to have the Java Development Kit (JDK) installed on your system. Gradle runs on the Java Virtual Machine (JVM), just like Java applications.

  • Ensure you have JDK 8 or higher.
  • You can check your Java version with: java -version

How to Install Gradle

There are several ways to install Gradle. For beginners, using a version manager like SDKMAN! is highly recommended. It simplifies managing multiple SDK versions.

  • SDKMAN!: Easy and flexible.
  • Manual Download: More setup required.
  • Package Managers: Homebrew (macOS), Chocolatey (Windows).

Install Gradle via SDKMAN!

SDKMAN! (Software Development Kit Manager) makes installing Gradle super easy. If you don't have SDKMAN!, install it first by following instructions on sdkman.io.

Once SDKMAN! is ready, open your terminal and run:

sdk install gradle

Check Your Gradle Version

After installation, it's a good practice to verify that Gradle is correctly installed and accessible from your terminal. This command shows the Gradle version and other environment details.

Run this in your terminal:

gradle -v

Discovering Gradle Tasks

The most common command to start with is gradle tasks. This command lists all available tasks for the current project. If you're not in a Gradle project, it shows generic tasks.

Let's try it:

gradle tasks

What `gradle tasks` Shows

When you run gradle tasks, you'll see categories like "Build tasks", "Verification tasks", etc., each with a list of tasks and their descriptions.

  • Tasks: Are the actual actions Gradle performs (e.g., build, clean, test).
  • Description: Explains what each task does.

This output helps you understand what operations your project supports.

Need Help? Use `gradle help`

Gradle has a built-in help system. If you want to know more about a specific task, you can use the help task with the --task option.

For example, to learn about the build task:

gradle help --task build

Intro to Gradle Wrapper (gradlew)

Many Gradle projects include a Gradle Wrapper (gradlew or gradlew.bat). This script ensures everyone uses the same Gradle version for a project, even if they don't have Gradle installed globally.

You'll often run commands like ./gradlew build instead of gradle build.

Test Your CLI Knowledge

Let's check your understanding of basic Gradle commands!

Recap: Gradle CLI Essentials

Great job! In this lesson, you learned how to:

  • Understand the role of the Gradle CLI.
  • Install Gradle using SDKMAN!.
  • Verify your installation with gradle -v.
  • List available tasks using gradle tasks.
  • Get help for specific tasks with gradle help --task <taskName>.
  • Briefly grasp the concept of the Gradle Wrapper.

Next, we'll dive into setting up a basic Gradle project!

無料で開始

AI チューターと学ぶ Groovy — 無料

ブラウザでリアルコードを書いて実行し、24/7 の AI チューターから瞬時にサポートを受け、ウェブまたはアプリで続きから学習できます。

コース
12
レッスン
48

よくある質問

「GradleのインストールとCLI」レッスンは無料ですか?

はい。「GradleのインストールとCLI」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Groovy & Gradle: JVM Automation and Build Engineeringコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Groovy & Gradle: JVM Automation and Build Engineeringコースには全4レッスンが含まれています。

「GradleのインストールとCLI」で何を学びますか?

Gradleをインストールし、コマンドラインインターフェースを理解して、基本的なビルドコマンドを実行します。 ブラウザで直接実行するハンズオンコードでGroovy & Gradle: JVM Automation and Build Engineeringを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Groovy & Gradle: JVM Automation and Build Engineeringを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのGroovy & Gradle: JVM Automation and Build Engineeringは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン1/4です。

「GradleのインストールとCLI」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このGroovy & Gradle: JVM Automation and Build Engineeringレッスンでコードを書いて実行できますか?

はい。すべてのGroovy & Gradle: JVM Automation and Build Engineeringレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. GradleのインストールとCLI
  2. Gradleプロジェクト構成
  3. タスクとビルドライフサイクル
  4. マルチプロジェクトビルドとSettingsファイル
← Groovy & Gradle: JVM Automation and Build Engineeringに戻る