Difference between using gradlew and gradle

Gradle tasks are run with either gradle or gradlew command.

Gradlew is an gradle wrapper for gradle command

This tutorial talks about difference between gradlew and gradle command. Difference between using gradlew and gradle

What you can do with Gradle command?

if your machine has a gradle installation, Then gradle command works as seen below.

It gives gradle version installed on local machine


> Task :help

Welcome to Gradle 6.0.1.

To run a build, run gradle <task> ...

To see a list of available tasks, run gradle tasks

To see a list of command-line options, run gradle --help

To see more detail about a task, run gradle help --task <task>

For troubleshooting, visit https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings

1 actionable task: 1 executed

Gradle installed on local machine, you can do following things.

  • You can create a new project using below command
gradle init

It creates a new project with asking input from user to type of projects, build script

B:\kiranw>gradle init

Select type of project to generate:
  1: basic
  2: application
  3: library
  4: Gradle plugin
Enter selection (default: basic) [1..4]

Select build script DSL:
  1: Groovy
  2: Kotlin
Enter selection (default: Groovy) [1..2]

Project name (default: kiranw):

> Task :init
Get more help with your project: https://guides.gradle.org/creating-new-gradle-builds

2 actionable tasks: 2 executed
  • You can add wrapper with gradle command to the project
gradle wrapper --gradle-version 7.1.1
  • You can run list out the tasks of an gradle
gradle tasks
  • you can run build or test the project using below command
gradle test
gradle build

Gradle wrapper

gradle wrapper command run by using ./gradlew command in linux and gradlew in windows. gradle wrapper can be added using below command

gradle wrapper --gradle-version 7.1.1

This is part of an gradle project with specific version installed

It does following things in a project

  • Checks gradle exists or not, if not inline installation with correct gradle version
  • Call gradle tasks

gradle-wrapper.properties contains the gradle wrapper configuration information

gradle wrapper commands add the wrapper to gradle project and following is an project structure.

└── <project folder>
    └── gradlew
    └── gradlew.bat
    └── build.gradle
    └── gradle
        └── wrapper
            └── gradle-wrapper.jar
            └── gradle-wrapper.properties

Comparision of gradle and gradlew commands

Gradlew   gradlew  
Installation and running is manual Gradle installation is by default do it
Local machine with single version  Each project can be configured different version
Local installation is required No local installation is required
All the tasks can be run with this command Except initialization of project, all other tasks can be executed
build, test, init,wrapper and any native tasks init and wrapper tasks will not work, other build, test and native tasks works
gradle setup will not configure to repository Always good way is to commit wrapper files to repository


In this tutorial, Learned difference between gradlew and gradle command

Both are same and equal except initializing and adding wrapper is not possible with gradle wrapper.

Join 6,000 subscribers and get a daily digest of full stack tutorials delivered to your inbox directly.No spam ever. Unsubscribe any time.

Similar Posts
You'll get a notification every time a post gets published here.