Skip to content

Instantly share code, notes, and snippets.

@niqdev
Last active March 5, 2024 13:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save niqdev/634d7e41630596934859b1a1030583b3 to your computer and use it in GitHub Desktop.
Save niqdev/634d7e41630596934859b1a1030583b3 to your computer and use it in GitHub Desktop.
Setup Gradle on Linux

Setup Gradle

Download

mkdir -p ~/opt/packages/gradle && cd $_
wget https://services.gradle.org/distributions/gradle-3.1-all.zip
unzip gradle-3.1-all.zip

Install and setup

The symlink will allow us to upgrade Gradle later without changing any other configuration.

ln -s ~/opt/packages/gradle/gradle-3.1/ ~/opt/gradle

Open your .profile file

atom ~/.profile

Paste the following at the bottom of your .profile file.

# Gradle
if [ -d "$HOME/opt/gradle" ]; then
    export GRADLE_HOME="$HOME/opt/gradle"
    PATH="$PATH:$GRADLE_HOME/bin"
fi

Finally, source your .profile and test gradle.

source ~/.profile
which gradle
gradle -version

Create new Java Project

gradle init --type java-library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment