使用Gradle在Artifactory上部署构件失败。

5
我想在Artifactory上部署我的Java库,但是我遇到了以下错误。 无法部署文件:HTTP响应代码:401。HTTP响应消息:未经授权。 我按照指南gradle artifactory插件进行操作。
下面是我的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
        }
    }
}

有人能指导我错在哪里吗?


你可以发布它,但没有删除权限以覆盖先前的部署。我猜还有其他解释... - roomsg
不,我并不想将快照构件发布到发行版存储库中。你可以在发布闭包repoKey=libs-snapshot-local中看到。我已经有了部署权限。 - Ashwin N Bhanushali
我是管理员,拥有所有权限。 - Ashwin N Bhanushali
20141126140940|16|请求|127.0.0.1|管理员|PUT|/libs-snapshot-local/com/infibeam/DAM_Consumer/1.0.0/DAM_Consumer-1.0.0.pom;build.name=DAM_Consumer;build.timestamp=1416991178596;build.number=1416991179079|HTTP/1.1|401|1012 这是我从Artifactory日志中得到的请求日志。 - Ashwin N Bhanushali
确实,我对快照构件和发布仓库有所误解。Artifactory的日志没有提供帮助,你确定是关于“你自己”的部署(groupId/版本不符合要求)吗?也许发布你的gradle输出会有帮助(使用'-i'或'-d'参数)。 - roomsg
显示剩余3条评论
1个回答

0

这可能发生在~/.m2/settings.xml或$GRADLE_USER_HOME/gradle.properties损坏时,尤其是在使用加密密码访问Artifactory时。请尝试再次生成它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接