How to run Gradle from the command line on Mac bash

JavaMacosBashGradle

Java Problem Overview


I have a very simple question. I am brand new to Mac and I am trying to get my Java project moved over to my new Mac. The project has a Gradlew file that I thought I could run from the command line to build and run on any machine. When I do gradlew from the command line (in the location of the gradlew file) it says gradlew not found. Am I missing something on how to run a command from a bash shell?

Java Solutions


Solution 1 - Java

./gradlew

Your directory with gradlew is not included in the PATH, so you must specify path to the gradlew. . means "current directory".

Solution 2 - Java

Also, if you don't have the gradlew file in your current directory:

You can install gradle with homebrew with the following command:

$ brew install gradle

As mentioned in this answer. Then, you are not going to need to include it in your path (homebrew will take care of that) and you can just run (from any directory):

$ gradle test 

Solution 3 - Java

try this cmd

> git:(branch): cd android

> android git:(branch) ./gradlew gradle build --scan

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionBarodaprideView Question on Stackoverflow
Solution 1 - JavaAlex FilatovView Answer on Stackoverflow
Solution 2 - JavaEvin1_View Answer on Stackoverflow
Solution 3 - JavajeanyView Answer on Stackoverflow