当我运行 ./ gradlew uploadArchives
部署我的图书馆神器Artifactory的服务器,我收到以下错误:
上传:COM /例子/ Android的LIB / 1.0.0-SNAPSHOT / Android的LIB-1.0.0-20150311.112243-1.aar在HTTP远程仓库:// artifactory的:8081 / artifactory的/库快照本地 从远程传输3787K错误写入服务器Android的lib目录下:uploadArchives失败故障:建立失败,一个例外。* 什么地方出了错:执行失败的任务:Android的lib目录下:uploadArchives。>无法发布配置的档案>错误部署神器'com。示例:Android的lib目录下:AAR':错误部署神器:错误传送文件
在服务器上,根据从日志我的理解,我们收到错误401这里的日志:
20150311144749 | 2 |请求| 192.168.148.66 |为myuser | PUT |/libs-snapshot-local/com/example/android-lib/1.0.0-SNAPSHOT/android-lib-1.0.0-20150311.112243-1.aar|HTTP/1.1|401|3878210
我有以下的build.gradle:
buildscript { 库{ jcenter() } 依赖{ 类路径'com.android.tools.build:gradle:1.1.+ 类路径'com.github.dcendents:Android的Maven的插件:1.2 }}库{ jcenter()}应用插件:'com.android.library应用插件:'行家'应用插件:'com.github.dcendents.android-行家版本=1.0.0快照组=com。示例安卓{ compileSdkVersion 21 buildToolsVersion21.1.2 defaultConfig { 17的minSdkVersion targetSdkVersion 21 版本code 1 版本的versionName } buildTypes { 发布 { minifyEnabled假 proguardFiles getDefaultProguardFile('proguard的-android.txt'),'proguard-rules.pro } }}依赖{ 编译com.android.support:support-v4:21.0.2}uploadArchives { 配置= configurations.archives 库{ mavenDeployer { 库(网址:'HTTP:// artifactory的:8081 / artifactory的/库快照本地'){ 认证(用户名:artifactoryUsername,artifactoryPassword) } pom.project { 名称Android的库' 说明酷库' SCM { developerConnection'<回购网址>' } } } }}
解决方案
鉴别部分似乎被打破 - 密码不正确传递结果。它应该是:
库(网址:'HTTP:// artifactory的:8081 / artifactory的/库快照本地'){ 认证(用户名:artifactoryUsername,密码:artifactoryPassword)}
When I run ./gradlew uploadArchives
to deploy my library artifact to Artifactory server, I get the following error:
Uploading: com/example/android-lib/1.0.0-SNAPSHOT/android-lib-1.0.0-20150311.112243-1.aar to repository remote at http://artifactory:8081/artifactory/libs-snapshot-local
Transferring 3787K from remote
Error writing to server
android-lib:uploadArchives FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android-lib:uploadArchives'.
> Could not publish configuration 'archives'
> Error deploying artifact 'com.example:android-lib:aar': Error deploying artifact: Error transferring file
On the server, according to my understanding from the log, we receive error 401. Here's the log:
20150311144749|2|REQUEST|192.168.148.66|myuser|PUT|
/libs-snapshot-local/com/example/android-lib/1.0.0-SNAPSHOT/android-lib-1.0.0-20150311.112243-1.aar|HTTP/1.1|401|3878210
I have the following build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.+'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
}
}
repositories {
jcenter()
}
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'com.github.dcendents.android-maven'
version = "1.0.0-SNAPSHOT"
group = "com.example"
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName version
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.2'
}
uploadArchives {
configuration = configurations.archives
repositories {
mavenDeployer {
repository(url: 'http://artifactory:8081/artifactory/libs-snapshot-local') {
authentication(userName: artifactoryUsername, artifactoryPassword)
}
pom.project {
name 'android-lib'
description 'cool lib'
scm {
developerConnection '<repo url>'
}
}
}
}
}
解决方案
The authentication part seems to be broken - password is not passed correctly. It should be:
repository(url: 'http://artifactory:8081/artifactory/libs-snapshot-local') {
authentication(userName: artifactoryUsername, password: artifactoryPassword)
}