I am trying to use the following commands to first generate my jar file and then copy it to a directory. Both these commands are in a batch file.
mvn -f mypathtofile\pom.xml clean install
xcopy mypathtojarfile\myjar.jar newpath\*.* /R /Y
What I found out was that my xcopy never happened because mvn takes some time to generate the jar file and that xcopy never waited until the mvn was done generating that file before starting. I realized this when I searched the destination directory and never found the jar file that was supposed to be copied over.
So then I did some research and found out that I might be able to use this:
start /b /wait mvn -f mypathtofile\pom.xml clean install
xcopy mypathtojarfile\myjar.jar newpath\*.* /R /Y
That's when I encountered the issue where mvn starts up correctly and generates the jar file but it never returns from that. Basically, my command prompt just pauses forever after the mvn finishes and never executes the next line in the batch file. This is what I see in the command prompt:
[exec] [INFO] BUILD SUCCESS
[exec] [INFO] ------------------------------------------------------------------------
[exec] [INFO] Total time: 1.997 s
[exec] [INFO] Finished at: 2016-07-31T15:20:35-04:00
[exec] [INFO] Final Memory: 18M/488M
[exec] [INFO] ------------------------------------------------------------------------
[exec]
Is there a way for mvn to to tell the command line that it finished its job?
mvn
is a batch file (.bat
or.cmd
), you need to usecall mvn ...
... – aschipflcall
? – Travis Heeter/WAIT
option,call
always waits for the called script or command to finish... – aschipfl