Windows Batch file exists after maven command completes
Hi folks,
It’s been while since my last post. However here we go again.
Recently I have involved with some java projects. Here we used Apache Maven build tool to build and deploy the project. To avoid the repetition of typing maven build command (a lengthy one with custom build profiles) several times a day, I decided to create the following batch file.
echo OFF
cd “my_project_folder”
mvn clean install
echo ON
pause
Everything went fine with above set of commands excepts the pause command never executes. So I could never have a good look at the maven build results. After some research I found the solution.
mvn itself is a batch file. So with execution of mvn clean install line, my original batch file delegates the control to the maven batch file. But after the maven execution completes it never returns the control to the original batch file. So any command after the mvn clean install line never executes.
In order to return the control to the calling batch file you need to use it as
call mvn clean install
Solved.
Regs,
Lasith.
was facing same issue.
got mad trying start /wait.
Thanks for solution.
Regards,
Narayan.
Thank you very much – excactly what I’ve needed.