Accessing the web via proxy is not working when SystemProperties are defined in gradle.properties in project directory

How to reproduce: 1) Work behind a corporate firewall.

  1. Execute a build: Assert that your build breaks with: java.net.ConnectException: Connection refused 3) Put a gradle.properties file in the gradle user home and define the proxy settings (as described in http://www.gradle.org/docs/current/userguide/build_environment.html) 4) Execute a build: Assert that this works fine. 5) Move the gradle.properties file from the gradle user home to the project directory 6) Delete the gradle user home/caches folder to force Gradle to download the external libraries again 7) Execute a build: The build breaks with: java.net.ConnectException: Connection refused

I expect the same behaviour in step 7 as in step 4. How can I achieve this behaviour with a gradle.properties File I can check in to version control?

I am using: Java 1.7, Gradle 2.1

which repositories do you reference to? Are you using ‘mavenCentral’ declaration in your build? with gradle 2.1 we changed the mavenCentral repository to use https instead of http.

Maybe you see a side effect of this change here and you need to update your proxy settings using ‘systemProp.https…’ instead of ‘systemProp.http…’. Can you double check this?

cheers, René

We are using the mavenCentral declaration. Both systemProp.http… and systemProp.https… are defined in the gradle.properties file.

The system properties set in gradle.properties have an effect when downloading dependencies when the file is located in gradle user home but not when it is located in project directory.

Hey christian, unfortunately I can’t reproduce this. In my environment (osx, gradle 2.1) this is working correctly. can you check if the problem exists for https and for http?

cheers,
René
 

Hi Rene, thanks for checking. I found the problem: I am using a multi project build and I did only place the gradle.properties file in the root dir but not in the /buildSrc dir.