1

My private repo which is loaded from bintray used for all projects and needs credentials:

allprojects {
     jcenter()
     repositories {
        maven {
            url "http://myurl.bintray.com/sdk"
            credentials {
                username 'JohnDoe'
                password 'somePassword'
            }
        }
     }     
}

What's the best way to hide them?

Is it possible without creating new instance of Properties?

Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())

2 Answers 2

1

One way to do it is to set properties in the user specific file $HOME/.gradle/gradle.properties:

thePassword=somePassword

and in the build.gradle file:

credentials {
    username 'JohnDoe'
    password thePassword
}
0
Repositories{

maven{
name='tomRepo'
url=''
credentials(PasswordCredentials)
}
}

run a command in the console like this

./gradlew build --refresh-dependecies -PtomsRepoUsername=aws -PtomRepoPassword=$TOMS_REPO_PASSWORD

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.