Home > Build-Management, Software Engineering > Executing multiple mvn commands from a Windows batch file

Executing multiple mvn commands from a Windows batch file

If you try to run multiple Maven commands in a batch (.bat) file, it only runs the first one and exits to the command prompt cause mvn itself starts with a bat file. Use the call command for each call to mvn:

call mvn clean
if not "%ERRORLEVEL%" == "0" echo Exit Code = %ERRORLEVEL% exit /b

call mvn package
if not "%ERRORLEVEL%" == "0" echo Exit Code = %ERRORLEVEL% exit /b
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s