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

查看:74
本文介绍了如何在 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天全站免登陆