Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command window closing while executing gradle command from batch file

I am trying to write a very simple batch file to execute gradle commands for my java projects. I have written below script in a batch file and saved as build.bat

cd data-connector
gradle clean build -x test
gradle dist
cd..

Now the .bat file is placed in the correct folder. Trouble occurs as the execution reaches 3rd line of the script. The command prompt just stops on 3rd line, no errors nothing. All the environment variables are correctly set and permissions in place. Please point my mistake here, what I am missing. Why is this script not going beyond the 2nd line of the script.

like image 835
Sushant Gupta Avatar asked Sep 01 '25 22:09

Sushant Gupta


1 Answers

Try replacing "gradle" with "call gradle" on 2nd and 3rd lines. Your existing invocation calls gradle.bat and never returns.

Reference: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/call.mspx?mfr=true (you don't say which version of Windows you're using, but I think this has been the same for quite some time).

This is also answered here: Executing multiple commands from a Windows cmd script

like image 79
Andy McKibbin Avatar answered Sep 03 '25 20:09

Andy McKibbin