Ok, I'm trying to compile dependency on remote maven url (bitbucket). The problem is that i can't pass bitbucket authentication on that stage.
I've tried this:
repositories{
maven{ url "https:" + "${username}" + ":" + "${password}" + ...etc}
}
And it doesn't work for me. So i've enabled and connected via SSH. The question is: how to compile dependency from remote private maven repository (hosted on bitbucket) using SSH?
with my team were facing the same exact issue and we ended up solving it with the bitbucket REST API.
So putting the following code in the build.gradle file (in the project root)
allprojects {
repositories {
maven {
url 'https://api.bitbucket.org/1.0/repositories/REPO_OWNER/REPO_NAME/raw/BRANCH_NAME'
}
credentials {
username bitbucket_username
password bitbucket_password
}
}
}
Where the REPO_OWNER is your bitbucket username or the team name that owns the repo, REPO_NAME as you already know is the name of the repository you want to get the lib from and BRANCH_NAME the branch name.
Moreover the bitbucket_username and the bitbucket_password are defined in the gradle.properties in the following way:
bitbucket_username = yourBitbucketUsername
bitbucket_password = yourBitbucketPasword
Please notice that the username and the password are not written with any quote symbol.
I hope it will work for you!
From the dependency management section of the gradle documentation:
repositories {
maven {
url "sftp://repo.mycompany.com:22/maven2"
credentials {
username 'user'
password 'password'
}
}
}