Welcome! Please see the About page for a little more info on how this works.

+1 vote
in tools.deps by
retagged by

I've copied this question from #tools.deps slack channel :

Hi all! Does clojure take MAVEN_OPTS from environment variables? I can’t use keystore with clojure, but it’s work with mvn (directly). I need to use keystore.jks with self-signed corp certificates. I don’t have problems with credentials configured in settings.xml. Maven by default pick up settings from .mavenrc or MAVEN_OPTS, but I didn’t see any usages in sources of tools.deps

Thanks for any help!

2 Answers

+1 vote
by
0 votes
by

Hello. I'm a mvn noob. I know nothing about mvn or jks but I will try to dig about this.

At tools.deps repo, i see that it do not implement nothing about MAVEN_OPTS
https://github.com/clojure/tools.deps.alpha/search?q=MAVEN_OPTS&unscoped_q=MAVEN_OPTS

Nothing about keystore
https://github.com/clojure/tools.deps.alpha/search?q=keystore&unscoped_q=keystore

Looks like that clojure/tools.deps.alpha uses org.apache.maven.resolver API's
https://github.com/clojure/tools.deps.alpha/blob/master/deps.edn#L4

Then I find this repo
https://github.com/apache/maven-resolver

This repo do not implement nothing about MAVEN_OPTS
https://github.com/apache/maven-resolver/search?q=MAVEN_OPTS&unscoped_q=MAVEN_OPTS

But I found a occorence of keystore

https://github.com/apache/maven-resolver/blob/47edcfe69c4e52ced4cb93d65b7348b5645cdd68/maven-resolver-transport-http/src/test/java/org/eclipse/aether/transport/http/HttpTransporterTest.java#L71

MAYBE

clj -J-Djavax.net.ssl.keyStore=my-custom-keystore.jks

will work.
you can use :jvm-opts inside deps.edn

:alias {:custom-keystore {:jvm-opts ["-D..."]}}

then use clj -A:custom-keystore:dev:repl ....

by
Thank you for the help!
The first attempt I tried was to add :jvm-opts with alias, but it's doesn't work.
I found the easiest way - add certificates to cacerts. It's works.
But I think the best way it is support MAVEN_OPTS.
...