Why is Gradle build not sending authentication to Artifactory?

If you are using the SetEnv plugin in Jenkins or Hudson, it resets the environment variables the Gradle plugin is setting, which causes the build properties to not be sent.

This can be worked around by adding this JVM option to the Gradle execution:

-DbuildInfoConfig.propertiesFile=${BUILDINFO_PROPFILE}