[GRADLE-1679] gradlew does not support HTTP proxy authentication Created: 20/Jul/11 Updated: 04/Jan/13 Resolved: 06/Feb/12 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | 1.0-milestone-8 |
Type: | Improvement | ||
Reporter: | Matt Stine | Assignee: | Daz DeBoer |
Resolution: | Fixed | Votes: | 2 |
Issue Links: |
|
Description |
Gradle wrapper uses http.proxyHost and http.proxyPort to determine the proxy server to use. However, it does not support the http.proxyUser and http.proxyPassword parameters that are used for proxy authentication. |
Comments |
Comment by Matt Stine [ 20/Jul/11 ] |
I cloned this issue in an attempt to upvote it since it was closed - I'm sorry if that is bad form. I am currently unable to use gradlew behind a proxy w/ 1.0.0-milestone3. I have GRADLE_OPTS set, and things work fine when using an already installed version of Gradle. gradlew does not seem to consume the same proxy options. |
Comment by Hans Dockter [ 21/Jul/11 ] |
You can use system properties to make this work. To make them consumed by the wrapper, you could create a USER_HOME/.grade/gradle.properties For the rest, see: You could also add them as -D command line arguments. GRADLE_OPTS is not taken into consideration by the JVM that runs the wrapper. |
Comment by Matt Stine [ 21/Jul/11 ] |
Hmmm...have tried the USER_HOME/.gradle/gradle.properties route and it does not seem to work either for the wrapper. Same 407 error response. |
Comment by Hans Dockter [ 21/Jul/11 ] |
The logic for this can be found here: Not sure what is going wrong. |
Comment by Daz DeBoer [ 23/Jan/12 ] |
If you're getting a 407 response, it's because your proxy server requires authentication. Proxy Authentication is not currently supported for the Gradle Wrapper. |
Comment by Cristian [ 24/Jan/12 ] |
I modified GradleWrapperMain added private static void addSystemProperties(File rootDir) { System.getProperties().putAll( SystemPropertiesHandler.getSystemProperties(new File( gradleUserHome(), "gradle.properties"))); System.getProperties().putAll( SystemPropertiesHandler.getSystemProperties(new File(rootDir, "gradle.properties"))); if (System.getProperty("http.proxyUser") != null) { Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(System .getProperty("http.proxyUser"), System.getProperty( "http.proxyPassword", "").toCharArray()); } }); } } and works for me... |
Comment by Adam Murdoch [ 06/Feb/12 ] |
Reopening to change fix-for field. |
Comment by Luke Daley [ 15/May/12 ] |
Is this issue really resolved? We are getting reports that this doesn't work. See the bottom of http://forums.gradle.org/gradle/topics/_dhttp_nonproxyhosts_is_not_respected |
Comment by Luke Daley [ 15/May/12 ] |
Comment by Daz DeBoer [ 18/May/12 ] |
I'm pretty sure this is working. Integration test is WrapperProjectIntegrationTest. This functionality uses java.net.URL to download, and supports authentication as described in http://docs.oracle.com/javase/6/docs/technotes/guides/net/http-auth.html |
Comment by Ashutosh Kumar Nirala [ 21/May/12 ] |
@Cristian Then I modified the jar file as directed by you ( I downloaded the code (zip) from https://github.com/gradle/gradle) The class is getting modified, (I verified that by adding comments in extra lines I have added) |
Comment by Daz DeBoer [ 21/May/12 ] |
@Ashutosh: what version of Gradle do you have running? If you're planning on upgrading to M9 (or later), then you won't need to make any changes to wrapper code. This issue was fixed in M8, and is working for a number of people. However, because your current wrapper jar is built with an older version of gradle, you'll need to download the M9 distribution manually and rerun the 'wrapper' task so that your wrapper.jar is rebuilt with the latest code. Then you should be able to use the wrapper to download all future versions of gradle. |
Comment by Ashutosh Kumar Nirala [ 24/May/12 ] |
Hi Daz DeBoer, So far I have not used any build tool like Ant etc, I need this for rosjava installation. Also I am not proficient with Ubuntu (Linux) or ROS which is complicating things for me. Although by doing manual changes in the wrapper files I was able to run ./gradlew install and download files through gradle (it eventually failed at test, but that is I guess not related to installation of gradlew) kindly clarify my understanding on few things:- 1. I installed gradle from synaptic I am not sure about its version, on Gradle build time: Thursday, September 8, 2011 4:06:52 PM UTC I couldn't see this exact version on page : http://www.gradle.org/downloads 2. Also what is meant by rerunning the wrapper task in "rerun the 'wrapper' task so that your wrapper.jar is rebuilt with the latest code." what is wrapper task? 3. I am going through the userguide of gradle to understand the build process, is there a better way? Thanks |
Comment by Daz DeBoer [ 04/Jun/12 ] |
Once you've installed gradle, you should try running 'gradle' from the root of the rosjava project. If this doesn't work, please report your problem on the Gradle forums : http://forums.gradle.org |
Comment by Ashutosh Kumar Nirala [ 05/Jun/12 ] |
Hi Daz DeBoer, |