Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-15 Thread Alexander Kriegisch
Garret, while all of this is kind of intriguing on an academical level, it is much more than you asked in your original question: Now … what if I want to pass a single string "foo'bar" (note just one single quote in the string) as a single string to my `main()` method args array?

Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-15 Thread Garret Wilson
On 10/15/2023 9:24 AM, Garret Wilson wrote: On 10/15/2023 1:31 AM, Alexander Kriegisch wrote: … Let us settle on only using double quotes to enclose arguments containing spaces. Then, we do not need to escape single quotes and can use them literally. But we do need to escape nested double

Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-15 Thread Garret Wilson
On 10/15/2023 1:31 AM, Alexander Kriegisch wrote: … Let us settle on only using double quotes to enclose arguments containing spaces. Then, we do not need to escape single quotes and can use them literally. But we do need to escape nested double quotes. Let's make sure we don't confuse

Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-14 Thread Alexander Kriegisch
Escape hell, part 3: Powershell. Similar to Cmd.exe, but additionally, you need to use '--%' right after the 'mvn' command to stop PS from parsing the parameters any further as PS commands or whatever. The full command would be something like (my local testing example: mvn --% -pl some-app

Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-14 Thread Alexander Kriegisch
It seems as if today is not my day. First, I wrote a message in another thread with tons of typos, making it look as if I am not just bad in typing but actually unable to speak proper English. Now, I sent an incomplete message not addressing the actual question. Sorry for that to everyone. Let

Re: escaping single quote for Exec Maven Plugin `exc.args`

2023-10-14 Thread Alexander Kriegisch
Java CLI program arguments containing spaces are usually enclosed by double quotes, so I would recommend to use: -Dexec.args="one 'number two' three" This works in both UNIX-like shells (say, Git Bash on Windows) and in the Cmd.exe Windows shell, while -Dexec.args='one "number two" three'

escaping single quote for Exec Maven Plugin `exc.args`

2023-10-14 Thread Garret Wilson
Here's a fun one for your weekend. As you know from (almost) the beginning of time we could invoke a Java application using Maven using the Maven Exec Plugin, as in the following (although Maven's `--quiet` may be a recent addition): ```bash mvn exec:java