IntelliJ可以通过bash.exe而不是Windows cmd.exe运行gradle任务吗?

时间:2016-11-14 18:20:12

标签: windows intellij-idea git-bash gradlew

我使用IntelliJ为我的项目启动gradle构建任务,但似乎IntelliJ正在使用命令提示符(或cmd.exe)来启动gradle包装器,因为在构建期间我收到错误:< / p>

'cp' is not recognized as an internal or external command,
operable program or batch file.

我安装了git bash,并且从我的bash shell运行gradlew build成功,没有任何此类错误。

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

我尝试将默认的IntelliJ终端(文件 - >设置 - >终端)从cmd.exe更改为我的bash.exe,但这不起作用。

2 个答案:

答案 0 :(得分:0)

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

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

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

答案 1 :(得分:-1)

我通过将以下设置为默认终端,在Intillij中使用Bash for Windows终端。

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