Groovy & Gradle: JVM Automation and Build Engineering · Lekcja

Instalacja Gradle i CLI

Zainstaluj Gradle, poznaj jego interfejs wiersza poleceń i wykonuj podstawowe polecenia kompilacji.

Lekcja 1 z 411 kroki

Instalacja Gradle i CLI to bezpłatna lekcja Groovy & Gradle: JVM Automation and Build Engineering na CoddyKit. To lekcja 1 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Groovy & Gradle: JVM Automation and Build Engineering, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Groovy & Gradle: JVM Automation and Build Engineering zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

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!

Bezpłatny start

Ucz się Groovy dzięki korepetycjom AI — za darmo

Pisz i uruchamiaj kod w przeglądarce, otrzymuj natychmiastową pomoc od korepetytora AI dostępnego 24/7 i kontynuuj naukę w sieci lub w aplikacji.

Kursy
12
Lekcje
48

Często zadawane pytania

Czy lekcja „Instalacja Gradle i CLI” jest bezpłatna?

Tak — pełny tekst „Instalacja Gradle i CLI” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Groovy & Gradle: JVM Automation and Build Engineering, przejdź na CoddyKit PRO. Kurs Groovy & Gradle: JVM Automation and Build Engineering zawiera 4 lekcji w sumie.

Co nauczysz się w „Instalacja Gradle i CLI”?

Zainstaluj Gradle, poznaj jego interfejs wiersza poleceń i wykonuj podstawowe polecenia kompilacji. Ćwiczysz Groovy & Gradle: JVM Automation and Build Engineering z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Groovy & Gradle: JVM Automation and Build Engineering?

Nie wymagamy żadnego doświadczenia. Groovy & Gradle: JVM Automation and Build Engineering w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 1 z 4.

Ile czasu zajmuje lekcja „Instalacja Gradle i CLI”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Groovy & Gradle: JVM Automation and Build Engineering?

Tak. Każda lekcja Groovy & Gradle: JVM Automation and Build Engineering zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Instalacja Gradle i CLI
  2. Struktura projektu Gradle
  3. Zadania i cykl życia kompilacji
  4. Kompilacje wieloprojektowe i plik settings
← Powrót do Groovy & Gradle: JVM Automation and Build Engineering