How to configure Gradle build to download artifacts from Nexus with credentials?

repositories {

maven {

url “http://localhost:8081/nexus/content/groups/public

} }

I have this error :

Malformed challenge: Authentication challenge is empty Failed to get resource: HEAD. [HTTP HTTP/1.1 401 Unauthorized: http://localhost:8081/nexus/content/groups/public/org/slf4j/slf4j-api/1.6.4/slf4j-api-1.6.4.pom]

repositories {
     maven {
         credentials {
             username = 'joe'
             password = 'secret'
         }
           url "http://localhost:8081/nexus/content/groups/public"
      }
      }

Hi,

this configuration doesn’t work for me :

11:12:51.172 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /conte nt/groups/public/org/apache/httpcomponents/httpmime/4.2/httpmime-4.2.pom HTTP/1.1 11:12:51.179 [DEBUG] [org.apache.http.headers] >> GET /content/groups/public/org/apache/httpcomponen ts/httpmime/4.2/httpmime-4.2.pom HTTP/1.1 11:12:51.185 [DEBUG] [org.apache.http.headers] >> Accept-Encoding: gzip,deflate 11:12:51.191 [DEBUG] [org.apache.http.headers] >> Host: repo-build-factory.equities.net.intra 11:12:51.199 [DEBUG] [org.apache.http.headers] >> Connection: Keep-Alive 11:12:51.205 [DEBUG] [org.apache.http.headers] >> User-Agent: Gradle/1.6 (Windows 7;6.1;x86) (Sun Mi crosystems Inc.;1.6.0_19;16.2-b04) 11:12:51.214 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1. 1 401 Unauthorized 11:12:51.220 [DEBUG] [org.apache.http.headers] << HTTP/1.1 401 Unauthorized 11:12:51.226 [DEBUG] [org.apache.http.headers] << Date: Mon, 15 Jul 2013 09:12:51 GMT 11:12:51.233 [DEBUG] [org.apache.http.headers] << WWW-Authenticate: Basic 11:12:51.239 [DEBUG] [org.apache.http.headers] << Content-Type: text/html;charset=ISO-8859-1 11:12:51.246 [DEBUG] [org.apache.http.headers] << Cache-Control: must-revalidate,no-cache,no-store 11:12:51.252 [DEBUG] [org.apache.http.headers] << Content-Length: 1448 11:12:51.258 [DEBUG] [org.apache.http.headers] << Server: Jetty(7.5.4.v20111024)