To make project totally independent from the Gradle installation version and get all the benefits from the Gradle buildpath it is a good idea to generate Wrapper script and put it into the project.

This action will protect project developers before using different Gradle version on each development machine and make development environment setup easier for the new contributors.

As a final effect you should get these files:

gradlew - Unix script version
gradlew.bat - Windows script version
    gradle-wrapper.jar - jar with Gradle distribution used by wrapper script - self expained

To generate these files, in console go to the project directory and execute:

gradle wrapper

As you remember from Setup Java project with Gradle wrapper task is one of the default Gradle tasks, so you got this feature for free.

Build Setup tasks
init - Initializes a new Gradle build. [incubating]
wrapper - Generates Gradle wrapper files. [incubating]

If your project should includes different Gradle version than currently installed on your machine then use additional argument:

gradle wrapper --gradle-version 2.4

Now you can use generated scripts to execute tasks, e.g.

./gradlew build

To have full Java/Gradle wrapper project initialisation you should activate Gradle plugin in the IDE (IntelliJ IDEA) by defining:

Gradle IDE settings

Gradle pluging window should be available with similar content:

Gradle plugin window

All the genearted Gradle Wrapper files should be commited to the repository.

Remember to exclude gradle-wrapper.jar file, because usually .jar files by default are ignored in .gitignore file. You should add extra line:

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)