如何在Gradle中使用加密密码访问Maven存储库 [英] How can I use an Encrypted Password to a Maven Repository in Gradle

查看:275
本文介绍了如何在Gradle中使用加密密码访问Maven存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试将Maven构建转换为Gradle构建.我遇到的障碍是我们的内部构件已部署到需要身份验证才能读取的内部存储库中.

I'm currently trying to transisiton a maven build to a Gradle build. The show stopper hurdle I've hit is that our internal artifacts are deployed to an internal repository that requires authentication to read.

您知道身份验证的含义...用户名和密码.问题是我不想要求开发人员将密码以纯文本格式存储在其硬盘驱动器上. Maven支持密码加密,但是我不知道如何使Gradle进行它.

And you know what authentication means... usernames and passwords. The problem is I don't want to require developers to store their password as plaintext on their hard drives. Maven supports password encryption but I'm not seeing how to make Gradle do it.

是否存在对Ivy CredentialStore的魔术访问,该访问将支持加密密码?还是我必须等待新版本?

Is there some magic access to the Ivy CredentialStore that will support encrypted passwords? or will I have to wait for a new version?

推荐答案

我们使用Artifactory,Ivy的CredentialsStore可以正常工作.

We use Artifactory and Ivy's CredentialsStore works fine.

repositories {
  org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials(REALM, HOST, USER, PASSWORD);
  mavenRepo urls: [ "http://repo.mycompany.com/repo" ]
}

要让每个开发人员使用不同的用户名,请创建一个包含以下内容的gradle.properties文件

To have each developer use a different username create a gradle.properties file that contains

HOST=repo.mycompany.com
REALM=My Company Realm
USER=theusername
PASSWORD={DESede}xyz123abc

{DESede}加密密码前缀可以是工厂特定约定.

The {DESede} encrypted password prefix may be a Artifactory specific convention.

这篇关于如何在Gradle中使用加密密码访问Maven存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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