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 -Dexec.mainClass="com.example.MyApplication"
-Dexec.args="test" --quiet
```
This passes a single command-line argument to my Java `main()` method
args array: "test". If I want to pass a string with a space, I put it in
single quotes, like this:
```bash
mvn exec:java -Dexec.mainClass="com.example.MyApplication"
-Dexec.args="'foo bar'" --quiet
```
That passes a single string "foo bar" to my application `main()` method
args array.
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? is there some way to escape the single quote? The
[documention](https://www.mojohaus.org/exec-maven-plugin/java-mojo.html#commandlineArgs)
doesn't give any clues.
I guess I could look at the Exec Maven Plugin source code (if it's
available), but that would take half a day and I've already spent half
of today going down other rabbit holes. So I thought I'd ask here to see
if anyone knew; otherwise I'll investigate another day when I'm
refreshed (or just put a temporary note in my Bash script about this
corner case, but that's not really my style).
Garret
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org