Hi all,

Is it intended our jvm.config impl does not support spaces?

-Dfoo=bar dummy
"-Dfoo=bar dummy"
'-Dfoo=bar dummy'
-Dfoo=bar\ dummy

All these options don't work - which can be surprising when you are used to
bash.
Fun thing is that if you take of them which should work and append echo
before our final exec and run what is printed it works.

This is mainly due to the fact it uses $MAVEN_OPTS variable in the command
and that bash will split on the space - whatever syntax you use - this way.
Indeed we can't quote the variable since it is not a single one too in
current config.

There are a few options but none are working out of the box:

1. use a string array for jvm.config instead of plain string variable (we
can use lines I guess for that) and then inject "${JVM_CONFIG_OPTS[@]}" in
the exec line - indeed we would default to an empty array
2. Have something specific for system properties like jvm.system.properties
and use the same trick than 1 but without any compat issue - but a new file
as a pitfall
3. Handle the system properties in java - but it is not possible for a few
of them
4. use a custom syntax to detect quoted system properties and extract them
to handle them properly - not sure it is that trivial in bash
4bis. enable to add dropped lines in jvm.config to mark sections:

per_line #will be dropped
-Dfoo=with spaces
-Dfoo2=with spaces too
inline #current impl
-Da=1 -Db=2

5. now we have graalvm and it works quite reliably we can have a small
binary in the distro we build from a new maven-prestart module - and this
module would replace the bash/batch script by doing it in plain java.
Drawback there is the size of the distro will take something around 30M
just for that.
6. same than 5 but in plain java - I fear the ~120ms of latency java
commonly has will kill this option

Any workaround I missed - without patching my maven script locally since it
is a config I want to share on CI and other dev computer?
Any solution I proposed which is tempting or any other solution?

Side note: for the full story I just wanted to set:
-Djava.util.logging.SimpleFormatter.format=[%4$s] %5$s%6$s%n


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>

Reply via email to