且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于存储库的Gradle使用证书身份验证

更新时间:2023-11-30 19:09:10

问题是Java进程没有用于身份验证的证书.

The Problem was that the Java process didn't have the certificate for authentication.

在我的第一种方法中,我走得很近,但是我忘记添加公司的根CA证书.我公司的私人证书属于根CA,因此必须将两者都提供给Java.

In my first approach I came very close but I forgot to add the company's root CA cert. My company's private certificate belongs to the root CA, so both must be provided to java.

解决方案:

首先将您的私人公司证书提供给gradle程序.

First provide your private company certificate to the gradle process.

编辑用户gradle.properties并添加

Edit your user gradle.properties and add

org.gradle.jvmargs=-Djavax.net.ssl.keyStore="/Users/myusername/certificates/my_private_company_cert.p12" -Djavax.net.ssl.keyStoreType=KeychainStore -Djavax.net.ssl.keyStorePassword=changeit

然后将公司的根ca证书导出到Java密钥库中.

Then export your company's root ca cert to the java keystore.

sudo keytool -import -trustcacerts -alias root -file ./certificates/company_root_ca.crt -keystore $JAVA_HOME/jre/lib/security/cacerts

这就是证书身份验证现在应该可以正常工作.

Thats it certificate authentication should now work.

例如,用于创建自己的android libary项目并将其推送到工件服务器. https://medium. com/android-news/the-complete-guide-to-creating-an-android-library-46628b7fc879#.naboz7yng

This is used for example to make own android libary projects and push them to a artifact server. https://medium.com/android-news/the-complete-guide-to-creating-an-android-library-46628b7fc879#.naboz7yng