Gradle установка mac os

Installation

The current Gradle release is 7.2. You can download binaries and view docs for all Gradle versions from the releases page.

Prerequisites

Gradle runs on all major operating systems and requires only a Java JDK version 8 or higher to be installed. To check, run java -version :

Additional resources

  • On-demand and live online training is available for free to Gradle users.
  • Self-paced tutorials are a good place to try Gradle with a variety of languages in addition to the docs.
  • Gradle has a visual build inspection tool: Build Scan™.
  • Finally, the Gradle Newsletter is a great way to keep UP-TO-DATE , with issues crafted monthly.

Installing with a package manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.

Homebrew is “the missing package manager for macOS”.

Other package managers are available, but the version of Gradle distributed by them is not controlled by Gradle, Inc. Linux package managers may distribute a modified version of Gradle that is incompatible or incomplete when compared to the official version (available from SDKMAN! or below).

› Additional helpful information

Installing manually

Step 1. Download the latest Gradle distribution

The current Gradle release is version 7.2, released on 17 Aug 2021. The distribution zip file comes in two flavors:

If in doubt, choose the binary-only version and browse docs and sources online.

Need to work with an older version? See the releases page.

Step 2. Unpack the distribution

Linux & MacOS users

Unzip the distribution zip file in the directory of your choosing, e.g.:

Microsoft Windows users

Create a new directory C:\Gradle with File Explorer.

Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-7.2 to your newly created C:\Gradle folder.

Alternatively you can unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.

Step 3. Configure your system environment

Linux & MacOS users

Configure your PATH environment variable to include the bin directory of the unzipped distribution, e.g.:

Microsoft Windows users

In File Explorer right-click on the This PC (or Computer ) icon, then click Properties -> Advanced System Settings -> Environmental Variables .

Under System Variables select Path , then click Edit . Add an entry for C:\Gradle\gradle-7.2\bin . Click OK to save.

Step 4. Verify your installation

Open a console (or a Windows command prompt) and run gradle -v to run gradle and display the version, e.g.:

› Additional helpful information

Upgrade with the Gradle Wrapper

If your existing Gradle-based build uses the Gradle Wrapper, you can easily upgrade by running the wrapper task, specifying the desired Gradle version:

Note that it is not necessary for Gradle to be installed to use the Gradle wrapper. The next invocation of gradlew or gradlew.bat will download and cache the specified version of Gradle.

› Additional helpful information

Older Releases

You can find all releases and their checksums on the releases page.

Command-Line Completion

Command-line completion scripts are available for bash and zsh. This provides completion for Gradle tasks and command-line options.

Источник

Installing Gradle

You can install the Gradle build tool on Linux, macOS, or Windows. This document covers installing using a package manager like SDKMAN! or Homebrew, as well as manual installation.

Use of the Gradle Wrapper is the recommended way to upgrade Gradle.

You can find all releases and their checksums on the releases page.

Читайте также:  Kompyuter oyin skachat windows 10

Prerequisites

Gradle runs on all major operating systems and requires only a Java Development Kit version 8 or higher to run. To check, run java -version . You should see something like this:

Gradle ships with its own Groovy library, therefore Groovy does not need to be installed. Any existing Groovy installation is ignored by Gradle.

Gradle uses whatever JDK it finds in your path. Alternatively, you can set the JAVA_HOME environment variable to point to the installation directory of the desired JDK.

Installing with a package manager

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-like systems (macOS, Linux, Cygwin, Solaris and FreeBSD). We deploy and maintain the versions available from SDKMAN!.

Homebrew is «the missing package manager for macOS».

Other package managers are available, but the version of Gradle distributed by them is not controlled by Gradle, Inc. Linux package managers may distribute a modified version of Gradle that is incompatible or incomplete when compared to the official version (available from SDKMAN! or below).

Installing manually

Step 1. Download the latest Gradle distribution

The distribution ZIP file comes in two flavors:

Complete (all) with docs and sources

Need to work with an older version? See the releases page.

Step 2. Unpack the distribution

Linux & MacOS users

Unzip the distribution zip file in the directory of your choosing, e.g.:

Microsoft Windows users

Create a new directory C:\Gradle with File Explorer.

Open a second File Explorer window and go to the directory where the Gradle distribution was downloaded. Double-click the ZIP archive to expose the content. Drag the content folder gradle-7.2 to your newly created C:\Gradle folder.

Alternatively, you can unpack the Gradle distribution ZIP into C:\Gradle using an archiver tool of your choice.

Step 3. Configure your system environment

To run Gradle, the path to the unpacked files from the Gradle website need to be on your terminal’s path. The steps to do this are different for each operating system.

Linux & MacOS users

Configure your PATH environment variable to include the bin directory of the unzipped distribution, e.g.:

Alternatively, you could also add the environment variable GRADLE_HOME and point this to the unzipped distribution. Instead of adding a specific version of Gradle to your PATH , you can add $GRADLE_HOME/bin to your PATH . When upgrading to a different version of Gradle, just change the GRADLE_HOME environment variable.

Microsoft Windows users

In File Explorer right-click on the This PC (or Computer ) icon, then click Properties → Advanced System Settings → Environmental Variables .

Under System Variables select Path , then click Edit . Add an entry for C:\Gradle\gradle-7.2\bin . Click OK to save.

Alternatively, you could also add the environment variable GRADLE_HOME and point this to the unzipped distribution. Instead of adding a specific version of Gradle to your Path , you can add %GRADLE_HOME%/bin to your Path . When upgrading to a different version of Gradle, just change the GRADLE_HOME environment variable.

Verifying installation

Open a console (or a Windows command prompt) and run gradle -v to run gradle and display the version, e.g.:

You can verify the integrity of the Gradle distribution by downloading the SHA-256 file (available from the releases page) and following these verification instructions.

Next steps

Now that you have Gradle installed, use these resources for getting started:

Create your first Gradle project by following one of our step-by-step samples.

Sign up for a live introductory Gradle training with a core engineer.

Learn how to achieve common tasks through the command-line interface.

Configure Gradle execution, such as use of an HTTP proxy for downloading dependencies.

Subscribe to the Gradle Newsletter for monthly release and community updates.

Источник

Installing Gradle

Gradlicious!

Gradle is a fantastic build automation tool, capable of building everything from Java to iOS applications.

Installing Gradle can be intimidating if you are not familiar with the command line. In this post, I will outline how to install it on several platforms.

Note : This guide is not the final word on how to install Gradle. Some aspects can be changed to your liking.

Step 1. Download Gradle

Via a web browser

You can download Gradle from here. You will want the binary release, unless you want the source code and example code too. Gradle is platform agnostic; there are no operating specific downloads.

Via the command line

Step 2. Install the Java Development Kit (JDK)

Download the JDK for your operating system. Installing JDK is usually very straight forward:

  • For Windows and macOS, simply run the installer
  • For RedHat based Linux systems, install the .rpm
  • For other Linux operating systems, checkout Salem’s post.
Читайте также:  Команда создания папки линукс

Step 3. Setup Gradle

While Gradle is platform agnostic, you still need to do some platform-specific configuration. See below for instructions specific to your operating system.

Setup on macOS

Note : When I say ‘directory’, I am referring to a standard macOS ‘folder’.

  1. Extract the Gradle archive to your Desktop. Remember the name of the directory that is extracted from the archive, you will need it later
  2. Open the Terminal application from the Utilities directory
  3. Type sudo mkdir /Applications/gradle and hit enter
  4. Type cd /Applications/gradle and hit enter
  5. Type sudo cp -r

/Desktop/name-of-gradle-directory . and hit enter

  • Type sudo ln -s name-of-gradle-directory target and hit enter
  • Type sudo ln -s /Applications/gradle/target/bin /usr/local/bin/gradle and hit enter
  • Quit and open a new Terminal. Type gradle —version to confirm it is working
  • You can now delete both the Gradle archive and the Gradle directory that you extracted to your Desktop
  • Setup on Windows

    Note : When I say ‘directory’, I am referring to a standard Windows ‘folder’.

    1. Extract the Gradle archive to your Desktop. Remember the name of the directory that is extracted from the archive, you will need it later
    2. Open a new File Explorer window and open the C:\ drive
    3. Create a new directory named ‘gradle’ in C:\
    4. Copy the directory you extracted from step 1. into the new ‘gradle’ directory
    5. Open the Windows menu (the Start menu), and type ‘Command Prompt’
    6. Right click on ‘Command Prompt’ and select ‘Run as Administrator’
    7. Type cd C:\gradle into the Command Prompt and hit enter
    8. Type mklink /J target name-of-gradle-directory
    9. Open the Windows menu again, and type ‘System Environment Variables’. Open the resulting shortcut
    10. Click the ‘Environment Variables’ button
    11. Under the ‘System Variables’, edit the ‘Path’ variable
    12. Click the ‘New’ button, and add C:\gradle\target\bin
    13. Click OK to save your changes
    14. Close the Command Prompt that we opened earlier, and open a new Command Prompt. Type gradle —version to confirm it is working
    15. You can now delete both the Gradle archive and the Gradle directory that you extracted to your Desktop

    Setup on Linux

    1. Extract the Gradle archive to your home directory. Remember the name of the directory that is extracted from the archive, you will need it later
    2. Open a new Terminal
    3. Type sudo mkdir -p /opt/gradle and hit enter
    4. Type cd /opt/gradle and hit enter
    5. Type sudo cp -r

    /name-of-gradle-directory . and hit enter

  • Type sudo ln -s name-of-gradle-directory target and hit enter
  • Type sudo ln -s /opt/gradle/target/bin /usr/local/bin/gradle and hit enter
  • Close and open a new Terminal. Type gradle —version to confirm it is working
  • You can now delete both the Gradle archive and the Gradle directory that you extracted to your home directory
  • Troubleshooting

    ‘Cannot find JAVA_HOME’ or ‘JAVA_HOME is not set’

    Make sure that you have installed Oracle’s Java Development Kit. After doing that, follow these instructions to set the JAVA_HOME variable.

    ‘Permission denied’ or similar permissions related errors

    On macOS or Linux, make sure that you are using sudo to copy Gradle installation files around. If you are on Windows, make sure you are running the Command Prompt as an Administrator when creating symlinks.

    Источник

    Getting Started

    Everyone has to start somewhere and if you’re new to Gradle, this is where to begin.

    Before you start

    In order to use Gradle effectively, you need to know what it is and understand some of its fundamental concepts. So before you start using Gradle in earnest, we highly recommend you read What is Gradle?.

    Even if you’re experienced with using Gradle, we suggest you read the section 5 things you need to know about Gradle as it clears up some common misconceptions.

    Installation

    If all you want to do is run an existing Gradle build, then you don’t need to install Gradle if the build has a Gradle Wrapper, identifiable via the gradlew and/or gradlew.bat files in the root of the build. You just need to make sure your system satisfies Gradle’s prerequisites.

    Android Studio comes with a working installation of Gradle, so you don’t need to install Gradle separately in that case.

    In order to create a new build or add a Wrapper to an existing build, you will need to install Gradle according to these instructions. Note that there may be other ways to install Gradle in addition to those described on that page, since it’s nearly impossible to keep track of all the package managers out there.

    Try Gradle

    Actively using Gradle is a great way to learn about it, so once you’ve installed Gradle, try one of the introductory hands-on tutorials:

    There are more samples available on the samples pages.

    Command line vs IDEs

    Some folks are hard-core command-line users, while others prefer to never leave the comfort of their IDE. Many people happily use both and Gradle endeavors not to discriminate. Gradle is supported by several major IDEs and everything that can be done from the command line is available to IDEs via the Tooling API.

    Android Studio and IntelliJ IDEA users should consider using Kotlin DSL build scripts for the superior IDE support when editing them.

    Executing Gradle builds

    If you follow any of the tutorials linked above, you will execute a Gradle build. But what do you do if you’re given a Gradle build without any instructions?

    Here are some useful steps to follow:

    Determine whether the project has a Gradle wrapperВ and use it if it’s there — the main IDEs default to using the wrapper when it’s available.

    Discover the project structure.

    Either import the build with an IDE or run gradle projects from the command line. If only the root project is listed, it’s a single-project build. Otherwise it’s a multi-project build.

    Find out what tasks you can run.

    If you have imported the build into an IDE, you should have access to a view that displays all the available tasks. From the command line, run gradle tasks .

    Learn more about the tasks via gradle help —task .

    The help task can display extra information about a task, including which projects contain that task and what options the task supports.

    Run the task that you are interested in.

    Many convention-based builds integrate with Gradle’s lifecycle tasks, so use those when you don’t have something more specific you want to do with the build. For example, most builds have clean , check , assemble and build tasks.

    From the command line, just run gradle to execute a particular task. You can learn more about command-line execution in the corresponding user manual chapter. If you’re using an IDE, check its documentation to find out how to run a task.

    Gradle builds often follow standard conventions on project structure and tasks, so if you’re familiar with other builds of the same type — such as Java, Android or native builds — then the file and directory structure of the build should be familiar, as well as many of the tasks and project properties.

    For more specialized builds or those with significant customizations, you should ideally have access to documentation on how to run the build and what build properties you can configure.

    Authoring Gradle builds

    Learning to create and maintain Gradle builds is a process, and one that takes a little time. We recommend that you start with the appropriate core plugins and their conventions for your project, and then gradually incorporate customizations as you learn more about the tool.

    Here are some useful first steps on your journey to mastering Gradle:

    Try one or two basic tutorials to see what a Gradle build looks like, particularly the ones that match the type of project you work with (Java, native, Android, etc.).

    Learn about the fundamental elements of a Gradle build: projects, tasks, and the file API.

    If you are building software for the JVM, be sure to read about the specifics of those types of projects in Building Java & JVM projects and Testing in Java & JVM projects.

    Familiarize yourself with the core plugins that come packaged with Gradle, as they provide a lot of useful functionality out of the box.

    The user manual contains a lot of other useful information and you can find samples demonstrating various Gradle features on the samples pages.

    Integrating 3rd-party tools with Gradle

    Gradle’s flexibility means that it readily works with other tools, such as those listed on our Gradle & Third-party Tools page.

    There are two main modes of integration:

    A tool drives Gradle — uses it to extract information about a build and run it — via the Tooling API

    Gradle invokes or generates information for a tool via the 3rd-party tool’s APIs — this is usually done via plugins and custom task types

    Tools that have existing Java-based APIs are generally straightforward to integrate. You can find many such integrations on Gradle’s plugin portal.

    Источник

    Читайте также:  Windows live password recovery
    Оцените статью