The Gradle Wrapper does not take any of the Gradle properties into account. Regarding the env variable, check and if necessary tweak the gradlew.bat - this has a chance of working.
Kind of related Gradle wrapper in environments that require controlled builds