Using Corporate/Internal Signed Certificates for privately hosted repository


(Shahji) #1

What’s the recommended way to add corporate/internally signed certificates to gradle so it can talk to privately hosted maven/nexus repository within corporate network?

One possible way I found in search is to set the options in the environment before launching gradlew.bat, like the following -

> set JAVA_OPTS=-Djavax.net.ssl.trustStore=C:\\Windows\\win.ini -Djavax.net.ssl.trustStoreType=Windows-ROOT
> gradlew.bat

which uses host machine’s trust store for authentication. This is, however, assuming that the host machines actually has valid certs already installed. Also, this solution is M$ Windows specific. How to do something similar on Unix/Linux and Mac?


(Daryl) #2

You are on the right track! You can specify the equivalent to your -D argument in ~/$GRADLE_USER_HOME/gradle.properties like the following example.

systemProp.javax.net.ssl.trustStore="/home/user/project/gradle/keystore"
systemProp.javax.net.ssl.trustStorePassword=xyzABC