Downloading jars from MavenCentral does not work at my company - Ivy configuration has to be modified

(Ralf Payer) #1

Downloading jars from MavenCentral does not work at my company.

As I understand, Ivy is used to handle repositories. I could trace the problem down to the fact, that Ivy (out of the box) does not work either, due to problems with the proxy and checksums.

I could fix the Ivy problem by forcing md5 checksums to be used in the ant script:

How can I do this configuration of Ivy in gradle?


Could you please try with the latests Milestone 6 snapshot? I’m not sure it will fix your problems, but it would be a good data point.

To answer your specific question, you can currently add and configure any ivy DependencyResolver instance:

However, over time we intend to replace this syntax with our custom DSL for defining repositories.

(Ralf Payer) #3

Hello Daz,

thanks for the quick response. I tried snapshot 6, but it didn’t work for me either.

Relevant Part of the log file: > 17:49:02.712 [DEBUG] [org.gradle.api.internal.artifacts.repositories.CommonsHttpClientBackedRepository] Attempting to get resource > 17:49:02.721 [DEBUG] [org.apache.commons.httpclient.HttpConnection] Open connection to > 17:49:02.744 [DEBUG] [httpclient.wire.header] >“GET /maven2/commons-collections/commons-collections/3.2/commons-collections-3.2.pom HTTP/1.1[\r][\n]” > 17:49:02.744 [DEBUG] [org.apache.commons.httpclient.HttpMethodBase] Adding Host request header > 17:49:02.753 [DEBUG] [httpclient.wire.header] >“User-Agent: Gradle/1.0-milestone-6-20111113105934+0100[\r][\n]” > 17:49:02.754 [DEBUG] [httpclient.wire.header] >“Host:[\r][\n]” > 17:49:02.754 [DEBUG] [httpclient.wire.header] >"[\r][\n]" > 17:49:03.753 [DEBUG] [org.apache.commons.httpclient.HttpMethodDirector] Closing the connection. > 17:49:03.753 [DEBUG] [org.apache.commons.httpclient.HttpMethodDirector] Method retry handler returned false. Automatic recovery will not be attempted > 17:49:03.754 [DEBUG] [org.apache.commons.httpclient.HttpConnection] Releasing connection back to connection manager.

As I pointed out in the first mail, I had connection problems with Ivy, too. I simply downloaded the Ant build.xml for building Ivy from and executed it. The result was a connection error.

After some research I found articles suggesting there may be problems with squid proxies and sha1 checksums. Therfore I tried the following
< property name=“ivy.checksums” value=“md5” />
in the Ant script. It forces Ivy to use md5 checksums instead of sha1 and this works for me. Is it possible that there is a similar problem with gradle? And if so, what can I do?



The strange thing is that when I use M6 with a simple build, it makes no attempt to download md5 or sha1 checksums. The log message you provide indicates that the GET request for the POM is failing.

Can you confirm that the following build breaks for you using M6? (You might want to temporarily move your .gradle/caches directory out of the way to ensure that caching isn’t having any impact.)

repositories {
configurations {
dependencies {
    one "commons-collections:commons-collections:3.2"
task show << { println }

(Ralf Payer) #5

Yes, it breaks also, see
> 17:14:38.798 [DEBUG] [org.apache.commons.httpclient.HttpConnection] Open connection to > 17:14:38.819 [DEBUG] [httpclient.wire.header] >> “GET /maven2/commons-collections/commons-collections/3.2/commons-collections-3.2.pom HTTP/1.1[\r][\n]” > 17:14:38.819 [DEBUG] [org.apache.commons.httpclient.HttpMethodBase] Adding Host request header > 17:14:38.828 [DEBUG] [httpclient.wire.header] >> “User-Agent: Gradle/1.0-milestone-6-20111113105934+0100[\r][\n]” > 17:14:38.828 [DEBUG] [httpclient.wire.header] >> “Host:[\r][\n]” > 17:14:38.828 [DEBUG] [httpclient.wire.header] >> “[\r][\n]” > 17:14:39.825 [DEBUG] [org.apache.commons.httpclient.HttpMethodDirector] Closing the connection. > 17:14:39.826 [DEBUG] [org.apache.commons.httpclient.HttpMethodDirector] Method retry handler returned false. Automatic recovery will not be attempted > 17:14:39.826 [DEBUG] [org.apache.commons.httpclient.HttpConnection] Releasing connection back to connection manager. > 17:14:39.829 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Skipping evicted #quickstart;unspecified(one). > 17:14:39.831 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on metadata file dynamic-revisions.bin. > 17:14:39.834 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:show’

Is there a special way to tell Gradle the proxy settings or a way to verify, if Gradle uses the correct proxy settings?

By the way, how did you manage to get this nice console window into your reply?


It’s not currently possible to specify proxy settings for the http connection used by built-in repository types (ivy {}, maven {}, mavenCentral {} etc). However, you can define a raw ivy resolver in the repositories block, giving you the power to configure it in any way you like (including setting the ‘checksums’ property).

So here are some things to try: - Try your build using Milestone 3, Milestone 5 and Milestone 6: is it broken with all versions? The log files from each of these could help diagnose the problem. - Try configuring an ivy resolver directly: check out section 34.5.6 here

To put code blocks in your post, surround them with a <code/> tag.

(Luca Guzzon) #7

Hi, I got the same problem with version M-5, M-6

not with M-3.

Thanks in advance


(Ralf Payer) #8

Hi Daz,

with M-3 the simple build script (dependencies one) from above works for me, but the samples java\quickstart and groovy\quickstart still fail. With M-5 and M-6 even the simple script failes.

What is the best way to provide all the log files?



Hey - sorry for the delay. One issue with M5 & M6 is that we don’t honour standard java settings for http proxies.

Could that be the root of your problems?

(Ralf Payer) #10

Today I tried Gradle 1.2 and the problem is gone.

(Peter Niederwieser) #11

Yes, we do support the standard Java HTTP proxy settings by now.