Gradle application plugin defaultJvmArgs are not escaped correctly

The applicationDefaultJvmArgs values are not escaped properly. I wanted to use a system-environment called PORT, but when i add the following to my build-script,

applicationDefaultJvmArgs = ['-Ddw.server.applicationConnectors[0].port=$PORT']

it is compiled into a shell script with this value:

DEFAULT_JVM_OPTS='"-Ddw.server.applicationConnectors[0].port=\$PORT"'

While what I wanted was without the escaping character like this:

DEFAULT_JVM_OPTS='"-Ddw.server.applicationConnectors[0].port=$PORT"'

A workaround is to use the WEBAPP_OPTS, but I would really like to keep the config as simple as possible.

I have also asked about this on stackoverflow with a comment from Peter Niederwieser here: http://stackoverflow.com/questions/25814455/gradle-application-plugin-and-system-environment-variables

Probably a duplicate of http://forums.gradle.org/gradle/topics/createstartscripts_in_application_plugin_escapes_whether_you_want_it_to_or_not ,

reported in GRADLE-3084