我想在Artifactory上部署我的java库工件但是我收到以下错误。 无法部署文件:HTTP响应代码:401。HTTP响应消息:未经授权。
我按照指南gradle artifactory plugin
以下是我的build.gradle
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile group: "com.squareup.retrofit", name: "retrofit", version: "1.7.0"
compile group: "com.squareup.okhttp", name: "okhttp", version: "2.0.0"
compile group: "com.squareup.okhttp", name: "okhttp-urlconnection", version: "2.0.0"
}
version = '1.0.0-SNAPSHOT'
group = 'com.xyz'
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/libs-release'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
name = "maven-main-cache"
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.0.1')
}
}
apply plugin: 'maven-publish'
repositories {
add buildscript.repositories.getByName("maven-main-cache")
}
allprojects {
apply plugin: 'com.jfrog.artifactory'
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-snapshot-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
任何人都可以指导我哪里出错了吗?
答案 0 :(得分:0)
It can be happened when ~/.m2/settings.xml or $GRADLE_USER_HOME/gradle.properties are corrupted. Explicitly when you use encrypted password for Artifactory access. Try to regenerated it again.