Skip to content

Instantly share code, notes, and snippets.

@keyboardsurfer
Last active March 16, 2020 14:40
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyboardsurfer/4135697f032dc8047c26 to your computer and use it in GitHub Desktop.
Save keyboardsurfer/4135697f032dc8047c26 to your computer and use it in GitHub Desktop.
function to use gradle wrapper if it exists, else gradle
# Simply add this to your .bashrc, .zshrc or .whateverrc and re-source it.
# Afterwards you can use `gw` to invoke your local gradle wrapper if it exists.
function gw {
if [ -x "gradlew" ]; then
./gradlew $@
else
gradle $@
fi
}
@alsutton
Copy link

alsutton commented Oct 3, 2014

Might be worth adding a check for $GRADLE_HOME/bin/gradle before using the path to find gradle to give people the option of specifying a gradle installation they want to use as a fall-back.

@keyboardsurfer
Copy link
Author

I don't have a gradle home env variable, but yes it might be worth a shot to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment