简体   繁体   中英

How to use Jfrog Artifactory packages in an gradle file in an android project

I have uploaded a few binary files in maven format to the jfrog artifactory, but could not seem to be able to resolve them in my project. This is what I am essentially doing,

build.gradle(app)

implementation 'io.sariska:sariska-media-transport:5.0.9'

build.gradle (project level)

allprojects { apply plugin: 'maven-publish' repositories { google() jcenter() maven { url = "https://sariska.jfrog.io/artifactory/sariska-media-libs-release-local/" } } }

在此处输入图像描述

Am I missing something here?

Well, in my situation I have declared a mavenRepoURL like this

mavenRepoURL = "https:link/to/artifactory"

Then I repositories section I have added

    maven {
        url = mavenRepoURL
        credentials {
            username artifactoryUser
            password artifactoryPwd
        }
    }

and the artifactoryUser and artifactoryPwd either hardcoded or get from proeties or environment variables with this function

artifactoryUser = getConfigurationProperty("ARTIFACTORY_USER", "artifactoryUser", null)
artifactoryPwd = getConfigurationProperty("ARTIFACTORY_PWD", "artifactoryPwd", null)

String getConfigurationProperty(String envVar, String sysProp, String defaultValue) {
    def result = System.getenv(envVar) ?: project.findProperty(sysProp)
    result ?: defaultValue
}

This wat I can add to my dependencies like maven central

implementation "name:ImportJava:1.2.1-SNAPSHOT"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM