gpt4 book ai didi

android - 通过 Gradle 构建将 Android AAR 库部署到 Artifactory 失败并出现错误 "Error deploying artifact: Error transferring file"

转载 作者:行者123 更新时间:2023-11-29 01:34:51 25 4
gpt4 key购买 nike

当我运行 ./gradlew uploadArchives 将我的库 Artifact 部署到 Artifactory 服务器时,出现以下错误:

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

在服务器上,根据我从日志中的了解,我们收到错误 401。这是日志:

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

我有以下 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>'
}
}
}
}
}

最佳答案

身份验证部分似乎已损坏 - 密码未正确传递。
应该是:

repository(url: 'http://artifactory:8081/artifactory/libs-snapshot-local') {
authentication(userName: artifactoryUsername, password: artifactoryPassword)
}

关于android - 通过 Gradle 构建将 Android AAR 库部署到 Artifactory 失败并出现错误 "Error deploying artifact: Error transferring file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28965844/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com