Gradle path 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.

Читайте также:  Ntp ��� ���� �� linux

Источник

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.

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:

Читайте также:  Installing windows application on linux

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.

Источник

How to define Gradle’s home in IDEA?

I am trying to import a Gradle project into IntelliJ, and when I get to the Gradle Home textbox, it is not automatically populated, nor will typing in the path of Gradle Home result in a valid location — I have the GRADLE_USER_HOME environment variable set (to what I think is!) the correct path, and I have been able to successfully import this same project into Eclipse. Any suggestions?

16 Answers 16

You can write a simple gradle script to print your GRADLE_HOME directory.

and name it build.gradle .

Then run it with:

If you installed with homebrew, use brew info gradle to find the base path (i.e. /usr/local/Cellar/gradle/1.10/ ), and just append libexec .

The same task in Kotlin in case you use build.gradle.kts :

Installed on a Mac via Homebrew, the path

is preferable to

since the former will survive version upgrades.

If you installed gradle with homebrew, then the path is:

Where X.X is the version of gradle (currently 2.1)

If you are using IntelliJ, just do the following.

  1. Close the project
  2. (re)Open the project
  3. you will see «Import gradle project» message on the right bottom. click.
  4. select «Use default gradle wrapper». not «Use local gradle distribution»

This is what helped me solve the problem of not having Gradle home set for the IDEA when importing a Gradle project.

THREE OPTIONS — (A) Default Wrapper (B) «gradle ‘wrapper’ task configuration» OR (C) «local gradle distribution» defined by jetbrains: https://www.jetbrains.com/help/idea/gradle-settings.html

A. Default Wrapper (recommended)

If you are able, select this recommended option. If it is grayed out, see option C, which should then set your default for all subsequent projects.

B. Gradle ‘Wrapper’ Task Configuration

If you want IDEA to define your gradle version for you from your build script

  1. Set this option if you define your gradle build versions as a task within your actual gradle build.

(useful if you do not want to share gradle builds between projects)

C. Local Gradle Distribution

This is because «libexec is to be used by other daemons and system utilities executed by other programs» (i.e. IDEA). Please see https://unix.stackexchange.com/questions/312146/what-is-the-purpose-of-usr-libexec

  1. IDEA should now have allowed you to hit OK

Источник

Build Environment

Interested in configuring your Build Cache to speed up builds? Register here for our Build Cache training session to learn some of the tips and tricks top engineering teams are using to increase build speed.

Gradle provides multiple mechanisms for configuring behavior of Gradle itself and specific projects. The following is a reference for using these mechanisms.

When configuring Gradle behavior you can use these methods, listed in order of highest to lowest precedence (first one wins):

Command-line flags such as —build-cache . These have precedence over properties and environment variables.

System properties such as systemProp.http.proxyHost=somehost.org stored in a gradle.properties file.

Gradle properties such as org.gradle.caching=true that are typically stored in a gradle.properties file in a project root directory or GRADLE_USER_HOME environment variable.

Environment variables such as GRADLE_OPTS sourced by the environment that executes Gradle.

Aside from configuring the build environment, you can configure a given project build using Project properties such as -PreleaseType=final .

Gradle properties

Gradle provides several options that make it easy to configure the Java process that will be used to execute your build. While it’s possible to configure these in your local environment via GRADLE_OPTS or JAVA_OPTS , it is useful to be able to store certain settings like JVM memory configuration and Java home location in version control so that an entire team can work with a consistent environment. To do so, place these settings into a gradle.properties file committed to your version control system.

Читайте также:  Как поменять комбинацию клавиш для смены языка mac os

The final configuration taken into account by Gradle is a combination of all Gradle properties set on the command line and your gradle.properties files. If an option is configured in multiple locations, the first one found in any of these locations wins:

command line, as set using the -P / —project-prop environment options.

gradle.properties in GRADLE_USER_HOME directory.

gradle.properties in project root directory.

gradle.properties in Gradle installation directory.

Note that the location of the Gradle user home may have been changed beforehand via the -Dgradle.user.home system property passed on the command line.

The following properties can be used to configure the Gradle build environment:

When set to true, Gradle will reuse task outputs from any previous build, when possible, resulting is much faster builds. Learn more about using the build cache.

When set to true, individual input property hashes and the build cache key for each task are logged on the console. Learn more about task output caching.

Enables incubating configuration on demand, where Gradle will attempt to configure only necessary projects.

Customize console output coloring or verbosity. Default depends on how Gradle is invoked. See command-line logging for additional details.

When set to true the Gradle Daemon is used to run the build. Default is true .

org.gradle.daemon.idletimeout=(# of idle millis)

Gradle Daemon will terminate itself after specified number of idle milliseconds. Default is 10800000 (3 hours).

When set to true , Gradle will run the build with remote debugging enabled, listening on port 5005. Note that this is the equivalent of adding -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 to the JVM command line and will suspend the virtual machine until a debugger is attached. Default is false .

org.gradle.java.home=(path to JDK home)

Specifies the Java home for the Gradle build process. The value can be set to either a jdk or jre location, however, depending on what your build does, using a JDK is safer. A reasonable default is derived from your environment ( JAVA_HOME or the path to java ) if the setting is unspecified. This does not affect the version of Java used to launch the Gradle client VM (see Environment variables).

Specifies the JVM arguments used for the Gradle Daemon. The setting is particularly useful for configuring JVM memory settings for build performance. This does not affect the JVM settings for the Gradle client VM.

When set to quiet, warn, lifecycle, info, or debug, Gradle will use this log level. The values are not case sensitive. The lifecycle level is the default. See Choosing a log level.

When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute projects in parallel. To learn more about parallel task execution, see the section on Gradle build performance.

Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Default is normal . See also performance command-line options.

Configures verbose logging when watching the file system. Default is off.

Toggles watching the file system. When enabled Gradle re-uses information it collects about the file system between builds. Enabled by default on operating systems where Gradle supports this feature.

When set to all , summary or none , Gradle will use different warning type display. See Command-line logging options for details.

org.gradle.workers.max=(max # of worker processes)

When configured, Gradle will use a maximum of the given number of workers. Default is number of CPU processors. See also performance command-line options.

The following example demonstrates usage of various properties.

Источник

Оцените статью