Is it possible to compile bitbucket dependency via SSH (Gradle)?

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?

  • Specify an SSH key for git push for a given domain
  • When using Git or SSH copy / remote login, etc, should we re-use the same SSH keys or create new ones every time?
  • How to configure git in ec2 with my local machine?
  • Xcode Server Bot won't connect to Gitlab server (Fails to integrate)
  • Clone git repository over ssh with username and password by Java
  • SSHing git@github.com shows wrong/old SSH key
  • Change Git remote repository password
  • Git, how to generate public key
  • 2 Solutions collect form web for “Is it possible to compile bitbucket dependency via SSH (Gradle)?”

    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'
            }
        }
    }
    
    Git Baby is a git and github fan, let's start git clone.