Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling Gradle from .bat causes batch execution to stop

I'm automating the publication of my Android app and I'm using Gradle, great utility!

Just a problem, consider this .bat file (under Windows 7):

:: assemble the project
gradle assemble -Pprofile_name=%profile_name% -p%destination_dir%

::copy apk to repository
copy "D:\compile\myapp\build\apk\*.apk" "d:\build_repository"

Well the copy command is never executed, never. It seems that the execution stops after calling gradle utility. Any idea?

The build within Gradle has ends with success and no error at all...

like image 538
Seraphim's Avatar asked Sep 19 '13 13:09

Seraphim's


1 Answers

I ran into this very same problem, but for a webapp. Gradle isn't necessarily the issue, but how you are invoking it. As explained in this post,

How to execute more than one maven command in bat file?

because gradle is a batch file itself, it completes execution and doesn't return control back to your batch file. Use the same 'call' strategy and everything should work. Like so for your original post,

call gradle assemble -Pprofile_name=%profile_name% -p%destination_dir%

::copy apk to repository
copy "D:\compile\myapp\build\apk\*.apk" "d:\build_repository"
like image 51
kmek Avatar answered Sep 23 '22 02:09

kmek