I did a test:
def value = "abc"
List<String> args = [ 'cmd', "-Dopt=${value}"];
System.out.println (args.getClass());
System.out.println (args.get(0).getClass());
System.out.println (args.get(1).getClass());
The output was:
class java.util.ArrayList
class java.lang.String
class org.codehaus.groovy.runtime.GStringImpl
Changing the code a bit to be:
def value = "abc"
List<String> args = [ 'cmd', "-Dopt=${value}".toString()];
System.out.println (args.getClass());
System.out.println (args.get(0).getClass());
System.out.println (args.get(1).getClass());
produced this:
class java.util.ArrayList
class java.lang.String
class java.lang.String
Should do the trick, but I'm not 100% sure this is the best way to do it.