Skip to main content
added 16 characters in body
Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn). The "$@" expansion is always a list, and the result of concatenating that with a string, as you do in your code, is not actually well defined (most shells behave as I describe here).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated bywith the first character from $IFS (usually a space) as the delimiter.

With With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn). The "$@" expansion is always a list, and the result of concatenating that with a string, as you do in your code, is not actually well defined (most shells behave as I describe here).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn). The "$@" expansion is always a list, and the result of concatenating that with a string, as you do in your code, is not actually well defined (most shells behave as I describe here).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated with the first character from $IFS (usually a space) as the delimiter. With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

added 40 characters in body
Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn). The "$@" expansion is always a list, and the result of concatenating that with a string, as you do in your code, is not actually well defined (most shells behave as I describe here).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space). The "$@" expansion is always a list (and the result of concatenating that with a string, as you do in your code, is not actually well defined).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space). The "$@" expansion is always a list (and the result of concatenating that with a string, as you do in your code, is not actually well defined).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn). The "$@" expansion is always a list, and the result of concatenating that with a string, as you do in your code, is not actually well defined (most shells behave as I describe here).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

added 309 characters in body
Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space). The "$@" expansion is always a list (and the result of concatenating that with a string, as you do in your code, is not actually well defined).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3.

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space). The "$@" expansion is always a list (and the result of concatenating that with a string, as you do in your code, is not actually well defined).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

See also What is the difference between $* and $@?

When the shell expands -Dexec.args="$@" and the list of positional parameters is arg1, arg2, arg3, then you get the list -Dexec.args=arg1, arg2, arg3 (three separate arguments for mvn).

What you likely want is "$*" in place of "$@". The expansion of "$*" is always a single string made up of the elements of the list of positional parameters, concatenated by the first character from $IFS (usually a space). The "$@" expansion is always a list (and the result of concatenating that with a string, as you do in your code, is not actually well defined).

With -Dexec.args="$*" you get the string -Dexec.args=arg1 arg2 arg3 (one single argument for mvn).

So:

mvn exec:java -Dexec.mainClass=my.App -Dexec.args="$*"

Note that if any argument contains spaces, it will be difficult for mvn to parse it correctly unless the tool supports some special escaping, quoting, or other encoding for handling that (and you use that in the argument list). I'm not a Maven user, so I don't know how it parses the exec.args value.

See also What is the difference between $* and $@?

Source Link
Kusalananda
  • 338.9k
  • 37
  • 682
  • 991
Loading