getting an error while trying to publish an artifa

2019-07-18 18:18发布

问题:

I'm trying to publish my android library to my private repo but i'm getting this error from the Terminal in android studio :

Could not publish build-info: Error occurred while requesting version information: Unauthorized

and this is the command :

gradlew.bat build artifactoryPublish

I used this link to help me set it up https://www.youtube.com/watch?v=mztbo8WwqRc

It's an official JFrog video

This is what i added to my project gradle :

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
           repoKey = 'libs-release-local'
           username = "${artifactory_user}"
           password = "${artifactory_password}"
           maven = true
       }
   }
   resolve {
       repository {
           repoKey = 'libs-release'
           username = "${artifactory_user}"
           password = "${artifactory_password}"
           maven = true
        }
    }
}

and this is my gradle.properties where i put the user and pass (got it from artifactory):

org.gradle.jvmargs=-Xmx1024m
artifactory_user=${security.getCurrentUsername()}
artifactory_password=${security.getEncryptedPassword()!"*****what_lookes_like_my_encrypted_password****"}
artifactory_contextUrl=http://10.0.1.4:8081/artifactory
org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_162
android.enableAapt2=false

I'm rather new to the Gradle and Artifactory worlds so any help will do , anyone knows what's wrong here ? Tnx!

回答1:

This seems to be a permissions issue. The user you are using for publishing should have at least deployment permissions to the target repository.
You can check the user permissions in the Admin > Security > Users > Edit User page (requires admin permissions)

Or by looking at the effective permissions tab when selecting a repository in the Artifact Repository Browser