To pass parameters containing a list to a Maven build from command line, we can use the "-D" option and pass the values as a comma separated. Maven internally converts this into List, and uses down the line. This has been answered in this question.
However, if the parameters I try to pass has comma (or any other special character like brackets) in them, how should I pass them?
Eg: I need to pass the following 3 strings from command line to Maven build. In the pom it can be done as:
<argsList>
<arg>Hello</arg>
<arg>Hello, Hi</arg>
<arg>Hello (Rohan, Ryan), Hi!</arg>
</argsList>
How do I pass these with the "-D" option? I tried encasing inside single...
mvn compile -Dmyproperty='Hello','Hello, Hi', 'Hello (Rohan, Ryan), Hi!'
and double quotes,
mvn compile -Dmyproperty="Hello","Hello, Hi", "Hello (Rohan, Ryan), Hi!"
but both fail.