1

I am trying to create a bash script to deploy an application. Prior to deploying, the application must be built using maven. The problem is, once the maven build finishes, the next command is never called. It seems like maven issues some signal to terminate any further execution.

E.g. in the following script, the Hello world is never written to standard output.

#!/bin/sh

exec mvn -DskipTests -Darguments=-DskipTests clean install

echo "Hello world"

Is there a way how to go around this limitation?

Andy
  • 121
  • 4

1 Answers1

5

Just remove the exec from your command line calling Maven.

The exec command replaces the shell with the command being executed, so the shell is no longer around and won't execute anything after that line (well, except if starting that command fails.)

If you want the shell around, just don't use exec for spawning external commands.

filbranden
  • 21,113
  • 3
  • 58
  • 84