Home > Software design >  Gradle sync failed: Could not install Gradle distribution from "https://employer.jfrog.io/emplo
Gradle sync failed: Could not install Gradle distribution from "https://employer.jfrog.io/emplo

Time:10-21

I need employer authorized SSO to login to jfrog in the browser.

I'm not sure how exactly to enter these credentials in gradle files

I tried installing the jfrog plugin in IntelliJ and adding the URLs in JFrog global configuration, but the test connection failed.

Original repo has

credentials {
   username = artifactory_user
   password = artifactory_password
}

in settings.gradle and artifactory.gradle

I tried replacing artifactory_user with my SSO username and password with the API key generated in JFrog. Still I get the same error on Gradle sync failed: Could not install Gradle distribution from "http://employer.jfrog.io/employer/gradle-distribution/gradle-7.0-bin.zip'

Please can anyone help?

CodePudding user response:

I'm not sure how exactly to enter these credentials in gradle files

have you tried gradle.properties or env variable ?

What am using to access mine is this function in gradle.build

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

and then i have local variable to retrive the values , wither from env variable or gradle.properties

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

where ARTIFACTORY_USER is enviroment var and artifactoryUser is gradle.properties variable .

and my gradle.properties look like this

artifactoryUser=user
artifactoryPwd=pass

make sure to add the gradle.properties to .gitignore if your using on Project level . or use on global level at %USER%/.gradle/gradle.properties if your using windows , $HOME/. gradle/gradle.properties or ( ~/. gradle/gradle.properties ) if your using Linux/ubuntu .

  • Related