Confusion with environemnt variables in exec task

I’m trying to exec a process with changed variable:

task ("some_task") {
exec {
     environment "new", "blablabla"
     executable "cmd"
     args "/c", "echo", "${}"

Unfortunately gradle doesn’t show new var when executing:
Starting process ‘command ‘cmd’’. Working directory: C:\xxx Command: cmd /c echo null.

Am I doing something wrong, or should I raise a bug?

You’re retrieving the variable “new” from the environment of the gradle process (where it isn’t set, hence null) and passing the string value “null” as an argument to the child process. Use

args "/c", "echo", "%new%"

and you should see it is being set in the environment of the child process.