Skip to content

arthurpicht/installGradleWrapperWithoutGradle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

installGradleWrapperWithoutGradle

How to install a gradle wrapper without gradle

TLDR: A bash script that installs a gradle wrapper in a java project without a running gradle installation. Just copy script create_gradle_wrapper.sh to the root of your project, make it executable and call it.

The official gradle documentation states:

To make the Wrapper files available to other developers and execution environments you’ll need to check them into version control. All Wrapper files including the JAR file are very small in size. Adding the JAR file to version control is expected. Some organizations do not allow projects to submit binary files to version control. At the moment there are no alternative options to the approach.

Well, I think, the last sentence is not entirely correct. Here is the solution:

  1. Copy the script create_gradle_wrapper.sh to the root of your gradle project and make it executable.

  2. If you want your gradle wrapper to be pinned to a specific version, declare the gradle_version variable in the first lines of the script. Leave it commented to get the latest version.

  3. Call script.

As prerequesites java and wget must be installed.

And finally you should put the following lines to your .gitignore file:

gradle/
gradlew
gradlew.bat

This script is based on a solution I found in the Lifeboat blog.

About

bash script for installing gradle wrapper without gradle

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages