Dipak
Dipak

Reputation: 177

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/" } } }

enter image description here

Am I missing something here?

Upvotes: 0

Views: 1618

Answers (1)

George
George

Reputation: 2502

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"

Upvotes: 1

Related Questions