是否有可能通过SSH(Gradle)编译bitbucket依赖关系? [英] Is it possible to compile bitbucket dependency via SSH (Gradle)?

查看:161
本文介绍了是否有可能通过SSH(Gradle)编译bitbucket依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我试图编译远程maven url(bitbucket)的依赖关系。问题是我无法在该阶段通过bitbucket身份验证。
我试过这个:

  repositories {
maven {urlhttps:+$ {username}+:+$ {password}+ ... etc}
}

它对我来说不起作用。所以我已经启用并通过SSH连接。问题是:如何使用SSH编译远程私有Maven仓库(托管在bitbucket上)的依赖关系?

解决方案

面对相同的问题,我们最终用bitbucket REST API解决了这个问题。
因此,将以下代码放入build.gradle文件中(在项目根目录中)

$ $ $ $ $ $ $ $ $ $ $ $ allprojects {
存储库{
maven {
url'https://api.bitbucket.org/1.0/repositories/REPO_OWNER/REPO_NAME/raw/BRANCH_NAME'
}
凭证{
username bitbucket_username
password bitbucket_password
}
}
}

如果您已知道 REPO_OWNER 是您的bitbucket用户名或拥有该repo的团队名称,那么 REPO_NAME 就是您想要获取的存储库的名称lib和 BRANCH_NAME 分支名称。



此外, bitbucket_username bitbucket_password 以下列方式在gradle.properties中定义:

  bitbucket_username = yourBitbucketUsername 
bitbucket_password = yourBitbucketPasword

请注意,用户名和密码没有使用任何引号符号。



我希望它能适合您!

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!

这篇关于是否有可能通过SSH(Gradle)编译bitbucket依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆