When I open the Terminal window (View -> Tool Windows -> Terminal) in IntelliJ IDEA, and type gradle tasks
, this is what I get to see:
C:\Sathyaish\MyJavaAndSpringBootProject>gradle tasks
'gradle' is not recognized as an internal or external command,
operable program or batch file.
I presume from the fact that IntelliJ IDEA shows the Gradle tool window (View -> Tool Windows -> Gradle) and the fact that the IDE is able to run gradle tasks, and list gradle dependencies, that the IDE automatically also installed gradle on my machine.
I searched my machine for a gradle folder that also had a bin directory but couldn't find any. I know that I haven't installed gradle on my own.
I did find a gradle folder inside the IntelliJ IDEA installation folder here:
C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.1\plugins\gradle>dir /b
lib
C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.1\plugins\gradle>dir lib /b
commons-io-2.2.jar
commons-lang-2.6.jar
gradle-base-services-3.5.jar
gradle-base-services-groovy-3.5.jar
gradle-cli-3.5.jar
gradle-core-3.5.jar
gradle-jps-plugin.jar
gradle-logging-3.5.jar
gradle-messaging-3.5.jar
gradle-model-core-3.5.jar
gradle-model-groovy-3.5.jar
gradle-native-3.5.jar
gradle-process-services-3.5.jar
gradle-resources-3.5.jar
gradle-tooling-api-3.5.jar
gradle-tooling-extension-api.jar
gradle-tooling-extension-impl.jar
gradle-version-info-3.5.jar
gradle-wrapper-3.5.jar
gradle.jar
guava-jdk5-17.0.jar
jansi-1.14.jar
kryo-2.22.jar
minlog-1.2.jar
native-platform-0.14.jar
native-platform-freebsd-amd64-libcpp-0.14.jar
native-platform-freebsd-amd64-libstdcpp-0.14.jar
native-platform-freebsd-i386-libcpp-0.14.jar
native-platform-freebsd-i386-libstdcpp-0.14.jar
native-platform-linux-amd64-0.14.jar
native-platform-linux-amd64-ncurses5-0.14.jar
native-platform-linux-amd64-ncurses6-0.14.jar
native-platform-linux-i386-0.14.jar
native-platform-linux-i386-ncurses5-0.14.jar
native-platform-linux-i386-ncurses6-0.14.jar
native-platform-osx-amd64-0.14.jar
native-platform-osx-i386-0.14.jar
native-platform-windows-amd64-0.14.jar
native-platform-windows-i386-0.14.jar
objenesis-1.2.jar
reflectasm-1.07.jar
resources_en.jar
C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.1\plugins\gradle>
How may I run the command gradle tasks
to list all gradle tasks from within the IntelliJ IDEA Terminal window? Should I add C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.1\plugins\gradle\lib to the PATH environment variable on my machine?
IntelliJ IDEA
uses the gradle wrapper
or the gradle distributed location
that you specify in your IntelliJ IDEA
settings, but when you are using the terminal window, it uses your native operating system command line, so if you don't have gradle
configured in your PATH
environment variable it will just not work because its doesn't know what gradle
is.
Add gradle
to your path in:
Windows
In File Explorer right-click on the This PC (or Computer) icon, then click
Properties -> Advanced System Settings -> Environmental Variables.
Under System Variables select Path, then click Edit.
Add an entry for C:\Gradle\gradle-3.5\bin. Click OK to save.
Linux / Mac
export PATH=$PATH:/opt/gradle/gradle-3.5/bin