JackWhiteIII
JackWhiteIII

Reputation: 1402

How do you set up Gradle properly and create a new Gradle project for IntelliJ IDEA?

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?

Upvotes: 28

Views: 80667

Answers (5)

BIRJA KUMAR
BIRJA KUMAR

Reputation: 79

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/

Upvotes: 0

lightup
lightup

Reputation: 674

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

Upvotes: 1

csonuryilmaz
csonuryilmaz

Reputation: 1735

(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

Upvotes: 0

Leo Ribeiro
Leo Ribeiro

Reputation: 1255

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!

Upvotes: 4

JB Nizet
JB Nizet

Reputation: 691645

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%

Upvotes: 44

Related Questions