gradle-node-plugin icon indicating copy to clipboard operation
gradle-node-plugin copied to clipboard

Pass "credentials" to "ivy" repository

Open mdreizin opened this issue 10 years ago • 5 comments

I have private artifactory server and it has nodejs mirror and by default all request should be authorized.

If I set distBaseUrl to use artifactory and I always get "401 Unauthorized", because gradle-node-plugin ignores credentials field.

IMHO ivy repo should not add automatically and developer should do that manually.

node {
    version = "4.1.2"
    npmVersion = "2.14.4"
    download = true
    distBaseUrl = "https://localhost:8080/artifactory"
}
Failed to get resource: GET. [HTTP HTTP/1.1 401 Unauthorized: https://localhost:8080/artifactory/nodejs/v4.1.2/ivy.xml]
Resource missing. [HTTP GET: https://localhost:8080/artifactory/repo/org/nodejs/node/4.1.2/node-4.1.2.pom]
Resource missing. [HTTP HEAD: https://localhost:8080/artifactory/repo/org/nodejs/node/4.1.2/node-4.1.2-darwin-x64.tar.gz]

mdreizin avatar Nov 04 '15 15:11 mdreizin

Hi. I will try to replicate this here locally.

srs avatar Nov 04 '15 22:11 srs

@srs Thanks, I'm looking forward to get it done :)

mdreizin avatar Nov 05 '15 08:11 mdreizin

@srs Also it ignores HTTP Basic Authentication credentials passed via url: https://user:password@localhost:8080/artifactory

mdreizin avatar Nov 05 '15 08:11 mdreizin

I experienced the same problem. +1 for getting this done.

@srs : Any thoughts on when this might become available?

balpeck avatar Apr 15 '16 18:04 balpeck

Add to build.gradle, works for me

project.repositories.whenObjectAdded {
    if (it instanceof IvyArtifactRepository) {
        it.authentication {
            basic(BasicAuthentication)
        }
        it.credentials {
            username "user"
            password "pass"
        }
    }
}

lizardusx avatar Nov 09 '18 12:11 lizardusx