Can't build gradle from sources because of proxy

To continue the previous topic (http://forums.gradle.org/gradle/topics/cant_build_last_sources_from_github_3_september_2012_build_comparison_integtest_errors) there is one unsolved problem with proxy.

In Windows 7 GradleBuildComparisonIntegrationSpec tests errors is gone (:build-comparison:integTest), but Pre12CompareGradleBuildsCrossVersionSpec tests fail because of proxy. The common exception is

can compare different builds with source pre 1.2 [1.1]
  java.lang.AssertionError: No matching cause found in '
FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':compareGradleBuilds'.
> Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.1-bin.zip'.
  * Try:
Run with --info or --debug option to get more log output.
  * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compareGradleBuilds'.
 at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:68)
 at
org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
 at
org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java :34)
 at
org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter$1.run(CacheLockHandlingTaskExecuter.java:34)
 at org.gradle.cache.internal.DefaultCacheAccess$3.create(DefaultCacheAccess.java:243)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:188)
 at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:241)
 at
org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:137)
 at
org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStat eCacheAccess.java:83)
 at
org.gradle.api.internal.changedetection.CacheLockHandlingTaskExecuter.execute(CacheLockHandlingTaskExecuter.java:32)
 at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:55)
 at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)
 at
org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:4 1)
 at
org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:51)
 at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:52)
 at
org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:42)
 at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:247)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.executeTask(DefaultTaskPlanExecutor.java:52)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.processTask(DefaultTaskPlanExecutor.java:38)
 at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:30)
 at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:83)
 at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at
org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter$1.run(TaskCacheLockHandlingBuildExecuter.java :31)
 at org.gradle.cache.internal.DefaultCacheAccess$2.create(DefaultCacheAccess.java:118)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:133)
 at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:116)
 at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:129)
 at
org.gradle.api.internal.changedetection.DefaultTaskArtifactStateCacheAccess.useCache(DefaultTaskArtifactStateCacheAccess .java:79)
 at
org.gradle.api.internal.changedetection.TaskCacheLockHandlingBuildExecuter.execute(TaskCacheLockHandlingBuildExecuter.ja va:29)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
 at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
 at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
 at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:158)
 at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
 at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
 at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:38)
 at
org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:39)
 at
org.gradle.launcher.exec.InProcessGradleLauncherActionExecuter.execute(InProcessGradleLauncherActionExecuter.java:25)
 at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
 at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:30)
 at org.gradle.launcher.cli.ActionAdapter.execute(ActionAdapter.java:22)
 at
org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:200)
 at
org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:173)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:138)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
 at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
 at org.gradle.launcher.Main.doAction(Main.java:48)
 at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
 at org.gradle.launcher.Main.main(Main.java:39)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
 at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
 at org.gradle.launcher.GradleMain.main(GradleMain.java:26)
Caused by: org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from
'http://services.gradle.org/distributions/gradle-1.1-bin.zip'.
 at
org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(Distributi onFactory.java:112)
 at
org.gradle.tooling.internal.consumer.loader.CachingToolingImplementationLoader.create(CachingToolingImplementationLoader .java:36)
 at
org.gradle.tooling.internal.consumer.loader.SynchronizedToolingImplementationLoader.create(SynchronizedToolingImplementa tionLoader.java:43)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.onStartAction(LazyConnection.java:122)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.withConnection(LazyConnection.java:105)
 at org.gradle.tooling.internal.consumer.connection.LazyConnection.run(LazyConnection.java:96)
 at
org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection$1.run(ProgressLoggingConnection.java:57)
 at
org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection.run(ProgressLoggingConnection.java:71)
 at
org.gradle.tooling.internal.consumer.connection.ProgressLoggingConnection.run(ProgressLoggingConnection.java:55)
 at
org.gradle.tooling.internal.consumer.connection.LoggingInitializerConnection.run(LoggingInitializerConnection.java:52)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$1.run(DefaultAsyncConnection.java:51)
 at org.gradle.tooling.internal.consumer.async.DefaultAsyncConnection$2.run(DefaultAsyncConnection.java:69)
 at
org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66)
Caused by: java.net.ConnectException: Connection timed out: connect
 at org.gradle.wrapper.Download.downloadInternal(Download.java:63)
 at org.gradle.wrapper.Download.download(Download.java:49)
 at
org.gradle.tooling.internal.consumer.DistributionFactory$ProgressReportingDownload.download(DistributionFactory.java:132 )
 at org.gradle.wrapper.Install.createDist(Install.java:51)
 at
org.gradle.tooling.internal.consumer.DistributionFactory$ZippedDistribution.getToolingImplementationClasspath(Distributi onFactory.java:108)
 ... 12 more
  '
 at org.junit.Assert.fail(Assert.java:93)
 at
org.gradle.integtests.fixtures.OutputScrapingExecutionFailure.assertThatCause(OutputScrapingExecutionFailure.java:73)
 at
org.gradle.integtests.fixtures.OutputScrapingExecutionFailure.assertHasCause(OutputScrapingExecutionFailure.java:48)
 at
org.gradle.api.plugins.buildcomparison.gradle.Pre12CompareGradleBuildsCrossVersionSpec.failBecauseNotIdentical(Pre12Comp areGradleBuildsCrossVersionSpec.groovy:149)
 at org.gradle.api.plugins.buildcomparison.gradle.Pre12CompareGradleBuildsCrossVersionSpec.can compare different
builds with source pre 1.2(Pre12CompareGradleBuildsCrossVersionSpec.groovy:92)

The problem is in

org.gradle.wrapper.Download.downloadInternal(Download.java:63)

For proxy I use gradle.properties:

systemProp.http.proxyHost=...
systemProp.http.proxyPort=...
systemProp.http.proxyUser=...
systemProp.http.proxyPassword=...

It works for most build, but it does not work in org.gradle.wrapper.Download. There is a SystemPropertiesProxyAuthenticator in Download.java, BUT it does NOT use gradle.properties.

which file are you setting ‘systemProp.http.proxy*’ in?

I use gradle.properties in root of gradle sourses (where gradlew.bat lies)

I’ve raised GRADLE-2463 for this. It’s a bit trickier.

The integration tests are Gradle builds and run with a tightly controlled environment for reproducibility. That is, they intentionally don’t inherit the user environment. We’ll have to consider inheriting just the proxy config.

In the meantime, you could amend the test to write the ‘gradle.properties’ to the root of the test project that the integration test is running against.

Thank you for an answer, I’ll try to overcome it somehow :slight_smile: