I'm writing a bash script which will execute some part of a maven project. The script looks like this:
CMD="mvn exec:java -Dexec.mainClass=$MAINCLASS -Dexec.args=\"cfg.txt TRAIN\""
echo "Running $CMD..."
$CMD
But this fails every time with the following error:
[ERROR] Unknown lifecycle phase "TRAIN". You must specify a valid
lifecycle phase...
If I skip the CMD=... assignment, and just run the mvn part directly, like this...
mvn exec:java -Dexec.mainClass=$MAINCLASS -Dexec.args="cfg.txt TRAIN"
...it works just fine.
How can I get maven and the exec plugin to understand that I have two arguments in the -Dexec.args section?