Skip to content

Instantly share code, notes, and snippets.

@AImissq
Forked from niqdev/setup-gradle.md
Created March 14, 2021 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AImissq/d9a21d70feb229d2c1c7b3b1186c42e6 to your computer and use it in GitHub Desktop.
Save AImissq/d9a21d70feb229d2c1c7b3b1186c42e6 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