Issue
I made a bat file like:
mvn clean; mvn package;
but it doesn't work, only the first command is executed.
can someone help me?
Solution
Use
call mvn clean
call mvn package
Note that you don't need semicolons in batch files. And the reason why you need to use call
is that mvn
itself is a batch file and batch files need to call each other with call
, otherwise control does not return to the caller.
If you want subsequent commands to echo to the command line (show in batch output), you must also do echo on
after the call mvn
is done (on the next line). This is because mvn
turns echo off and doesn't turn it back on.
Answered By - Joey
Answer Checked By - David Goodson (JavaFixing Volunteer)