I develop a android library and want to use gradle to publish it to my own maven repo.
Task ‘uploadArchives’ run successfully on my computer. However, run fail on jenkins server. I compare 2 gradle log and found difference.
-
Log on my computer:
Re-using cached ‘basic’ auth scheme for http://xxx
Target auth state: CHALLENGED
Proxy auth state: UNCHALLENGED
Attempt 1 to execute request
Sending request: PUT /nexus/content/repositories/xxx HTTP/1.1
Receiving response: HTTP/1.1 201 Created -
Log on jenkins server:
Auth cache not set in the context
Target auth state: UNCHALLENGED
Proxy auth state: UNCHALLENGED
Attempt 1 to execute request
Sending request: PUT /nexus/content/repositories/xxx.jar HTTP/1.1
Receiving response: HTTP/1.1 401 Unauthorized
I use plugin ‘maven’ to publish. The publish gradle file is like below:
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://url_to_maven") {
authentication(userName: "xxx", password: "xxx")
}
pom.project {
version publishVersion
artifactId PROJ_ARTIFACT_ID
groupId PROJ_GROUP_ID
packaging PROJ_PACKAGING
description PROJ_DESCRIPTION
}
}
}
}
Why 401?