IntelliJ能否通过bash.exe而不是Windows cmd.exe运行gradle任务?

IntelliJ能否通过bash.exe而不是Windows cmd.exe运行gradle任务?,windows,intellij-idea,git-bash,gradlew,Windows,Intellij Idea,Git Bash,Gradlew,我使用IntelliJ为我的项目启动gradle构建任务,但IntelliJ似乎正在使用命令提示符(或cmd.exe)启动gradle包装器,因为在我的构建过程中,我遇到了以下错误: 'cp' is not recognized as an internal or external command, operable program or batch file. 我已经安装了git bash,并且从我的bash shell运行gradlew build成功,没有任何此类错误 有没有办法告诉In

我使用IntelliJ为我的项目启动gradle构建任务,但IntelliJ似乎正在使用命令提示符(或cmd.exe)启动gradle包装器,因为在我的构建过程中,我遇到了以下错误:

'cp' is not recognized as an internal or external command,
operable program or batch file.
我已经安装了git bash,并且从我的bash shell运行
gradlew build
成功,没有任何此类错误

有没有办法告诉IntelliJ使用我的bash可执行文件而不是默认的Windows cmd.exe来运行gradle任务?


我尝试将默认IntelliJ终端(文件->设置->终端)从cmd.exe更改为我的bash.exe,但没有成功。

我在Intillij中使用bash for Windows终端,方法是将以下设置为默认终端

cmd.exe "/K set LINES=9999&C:\windows\system32\bash.exe"

我解决了这个问题,首先打开一个GitBash,然后从那里运行IntelliJ。IntelliJ终端随后自动设置为Bash终端,Gradle可以使用所有伟大的Bash命令

如果希望Git Bash窗口在启动IntelliJ后自动关闭,请尝试从PowerShell运行以下命令:

& git-bash.exe -c 'cmd //c start idea64.exe'

切向的,但是为什么在gradle任务中有依赖于shell的命令呢?如果您以标准方式编写它,它应该在任何shell/OS中工作。不幸的是,它来自我依赖的另一个团队的库。我的gradle构建脚本启动了一个
npm安装
,他们有一个安装后脚本,显然是在考虑linux/mac的情况下编写的。但如果我能让IntelliJ使用我的bash可执行文件,一切都应该正常。这很奇怪,因为我认为在安装git bash时,我特别选择了一个选项,使linux/bash命令在windows控制台中可用。