Setup your Gradle project

  • open a terminal and navigate to your home directory

  • create a directory for the project:

    mkdir get-going-with-gradle

  • navigate into the directory:

    cd get-going-with-gradle

  • create a Gradle project:

    gradle init

  • select the type of project to generate:


  • select the build script DSL:


  • accept the project name:


  • if asked ‘Generate build using new APIs and behavior?’, accept the default:


Interact with the new project

Try interacting with the project:

./gradlew help (Linux/Mac)

gradlew.bat help (Windows)

List available tasks:

./gradlew tasks (Linux/Mac)

gradlew.bat tasks (Windows)

Look at the different files in the project:

ls -l (Linux/Mac)

dir (Windows)

Explore the project files

Look inside build.gradle:

cat build.gradle (Linux/Mac)

type build.gradle (Windows)

Look inside settings.gradle:

cat settings.gradle (Linux/Mac)

type settings.gradle (Windows)

Look at any hidden files or directories:

ls -la (Linux/Mac)

dir/a (Windows)

Look inside the .gitignore:

cat .gitignore (Linux/Mac)

type .gitignore (Windows)

Commit the project into version control

Initialise this directory as a Git repository:

git init

Get all the files ready to be committed:

git add .

See what files are staged for commit:

git status

Commit everything:

git commit -m "Initialise project"

Good work! You just created your first Gradle project and committed it into version control.