28

So, I downloaded Gradle but I don't know how to set it up correctly. After I unzipped the zip file, what do I do next? I want to use Gradle in IntelliJ IDEA. From a livestream I've seen I know that there's a settings.gradle and a build.gradle file in the project folder in IntelliJ.

Also, I've seen that they used the windows console.

First of all, how do I access gradle through the windows console and tell it to generate a new project for IntelliJ?

As you can see, I don't have any experience with Gradle. Unfortunately I can't really find out how to use it.

I want the IntelliJ project then to have LWJGL and Slick.

Additionally, I know what it says in the build.gradle file I've seen on the livestream (I only want to create my project with the same structure like theirs).

Can anybody give a detailed description of what to do to achieve all this?

5
  • 2
    Gradle has a documentation page, containing a "Getting Started" chapter. Have you read it? gradle.org/docs/current/userguide/tutorials.html#N100CB Commented Mar 10, 2013 at 16:30
  • Besides the user guide, also check out the samples in the full Gradle distribution. Commented Mar 10, 2013 at 16:38
  • 1
    I read the part about Installing before, but some points don't seem clear to me. Unpacking, for instance. It tells me what the single zips contain, but not how to make them accessible in the console. and I do not understand how to set the GRADLE_HOME...They say something about PATH, but where do I find that? Commented Mar 10, 2013 at 16:40
  • 3
    Ouch. Then you need some help about Windows, not about Gradle. I'll give an answer in a few minutes. Commented Mar 10, 2013 at 16:46
  • I didn't do much with such things before. Well, there's always a first time... Commented Mar 10, 2013 at 16:50

5 Answers 5

44

Lets' say you unpacked gradle to d:\tools\gradle.

To add its bin directory it to the PATH in a console window, execute the following command:

set PATH=d:\tools\gradle\bin;%PATH% 

The above prepends the bin path to the current value of the PATH environment variable. This will only change the path for this specific command window.

If you want to add it to the PATH globally, then go to your control panel and choose System, then Advanced parameters (it might be something a little bit different: I'm translating from my French version of Windows). Then in the Advanced system parameters tab, click the button Environment variables.... Find the Path environment variable in the list, and add the directory, separated from the others using a semicolon (;).

Note: you can also define a new environment variable called GRADLE_HOME:

set GRADLE_HOME=d:\tools\gradle 

or globally, as explained above, and reference it inside the PATH variable:

set PATH=%GRADLE_HOME%\bin;%PATH% 
Sign up to request clarification or add additional context in comments.

2 Comments

Does Gradle (or any other application) actually uses GRADLE_HOME or it is just used to define the path?
GRADLE_HOME is not defined on my system and I use gradle all the time so I guess noone really cares
4

Just intall homebrew.

Then you can just open the terminal and install easy like:

brew install gradle 

Done! It's installed!

For test just type in your terminal:

gradle -v 

And you'll have something like this:

------------------------------------------------------------ Gradle 2.7 ------------------------------------------------------------ Build time: 2015-09-14 07:26:16 UTC Build number: none Revision: xxxxxxxxxxxxxxxxxxxxxxxxxx Groovy: 2.3.10 Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013 JVM: 1.8.0_60 (Oracle Corporation 25.60-b23) OS: Mac OS X 10.11.1 x86_64 

Then, open your IntelliJ and create a new gradle project as normal, just setting the gradle's path when necessary (normally in /usr/local/Cellar when installed with homebrew or /opt when installed other ways).

Good luck!

3 Comments

installed with homebrew however it didn't work with intelliJ. is it /usr/local/Cellar or /usr/local/Cellar/gradle ?? Also when we install gradle with homebrew do we still need to GRADLE_HOME?
@user1870400 /usr/local/Cellar/gradle/<version>/libexec
Could you please explain what homebrew does under the hood? in case some day it also become commercial and you have to pay to use it
1

For linux Users, User SDK Man to easily manage your gradle installation and path settings for development as well as gradle update

GET SDK MAN HERE

Comments

0

(for mac os users) Let's assume, you unpacked zip file into /Users/onuryilmaz/gradle-3.3 folder. Then open terminal and define a new environment variable called GRADLE_HOME:

export GRADLE_HOME=/Users/onuryilmaz/gradle-3.3 

After that reference it inside the PATH variable:

export PATH=$PATH:$GRADLE_HOME/bin 

Comments

0

just update the brew and install and set path that's all

  1. brew update && brew install gradle

  2. export PATH=$PATH:/opt/gradle/gradle-5.1.1/bin

  3. https://gradle.org/install/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.