things I tried in my script run.sh
:
mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$@"
mvn exec:java -Dexec.mainClass=my.App -Dexec.args=$@
when I call the script like:
./run.sh arg1 arg2 arg3
the arguments are not passed to Java application. instead Maven tries to interpret them as if they were maven options.
EDIT: I used -x
option. I see this:
mvn exec:java -Dexec.mainClass=my.App -Dexec.args=arg1 arg2 arg3
How can I get it to evaluate to:
mvn exec:java -Dexec.mainClass=my.App -Dexec.args="arg1 arg2 arg3"
that will fix my problem. I tried many variations, can't get it to work.
YourShell -x
? – Gilles Quénot Sep 22 '23 at 23:39"$*"
instead of"$@"
(i.e.-Dexec.args="$*"
-- see my answer here). If the arguments might need quoting or something similar it's more compicated. bash has a way to quote things in a bash-compatible way, but this probably requires different quoting/escaping syntax (and I don't know what that syntax is). – Gordon Davisson Sep 23 '23 at 00:11