Proxy for gradle runner

I need to use proxy as a system property while running a specific task with gradle runner.

GradleRunner runner = GradleRunner.create()
-Dhttps.proxyPort=8080", “test”)

I want all https requests in this task to go through a proxy. But it doesn’t work as expected. The request doesn’t even go through proxy.

Thanks in advance.