Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why does a set of commands in batch tend to stop after running only some of the commands?

The objective of my batch file is to do "mvn clean install", copy some environment files somewhere, then start the localhost server.

This is my batch file:

REM # change the following dirs accordingly
set webapp_dir=C:\cygwin\home\git\new_trunk
echo "moving to webapps project dir"
cd %webapp_dir%
echo "mvn clean install"
mvn clean install

---------------------it seems to finish the maven install then just stops
---------------------------i dont really wanna write 2 batch files just for this

set env_dir=C:\cygwin\home\git\new_trunk\etc\environment\dev\yao
set class_dir=C:\cygwin\home\git\new_trunk\webapps-dist\target\classes
cd %env_dir%
copy /y env.conf.bat %class_dir%
echo "copying env.conf file"

msg * maven install complete, the env.conf has been copied

set run_dir=C:\cygwin\home\git\new_trunk\webapps-dist\target\classes\jboss-as\bin
cd %run_dir%
echo "starting the server, run server 0.0.0.0"
run.bat -c server -b 0.0.0.0

When I say stop i mean this So it there a way to run everything here in one batch file?

like image 860
iCodeLikeImDrunk Avatar asked Aug 02 '12 17:08

iCodeLikeImDrunk


1 Answers

Try changing mvn clean install to call mvn clean install.

If mvn is another batch file, control won't get returned to your original batch file unless you explicitly call it with call.

like image 112
LittleBobbyTables - Au Revoir Avatar answered Oct 16 '22 16:10

LittleBobbyTables - Au Revoir