Fork me on GitHub
#tools-deps
<
2020-04-02
>
rfhayashi12:04:05

Hi! I'm trying to invoke tools.deps directly from clojure (more specifically clojure.tools.deps.alpha/resolve-deps) but I get a

Cannot access s3p://... using the registered transporter factories: HttpTransporterFactory, S3TransporterFactory, FileTransporterFactory
error. If I run a clj -Sdeps with the same content it works fine. Is there any library that I should include in the classpath to make s3 repos work? Or any environment variable or system property that I should set? I'm using org.clojure/tools.deps.alpha {:mvn/version "0.8.677"}.

Alex Miller (Clojure team)13:04:31

@rfhayashi did you try s3:// ? that's the only documented protocol for s3 access (s3p did work in some older versions but has never been supported)

Alex Miller (Clojure team)13:04:02

you should not have to do anything special to get s3 to work

rfhayashi13:04:03

@alexmiller it does work. thanks!

kszabo13:04:01

is there any support for modifying the bootclasspath, like: https://github.com/sunng87/lein-bootclasspath-deps does for leiningen? It would be nice to use some special case of :boot-deps so that I don’t have hack it together with downloading jar files locally from maven and using :jvm-opts directly

kszabo13:04:46

this seems to be in the focus area of tools-deps of invoking java with the correct dependencies ready

Alex Miller (Clojure team)14:04:30

you should not modify the bootclasspath in my opinion, so I'm not going to make that any easier

kszabo14:04:10

there are legitimate use-cases, like enabling alpn for jdk8 for http2: https://www.eclipse.org/jetty/documentation/current/alpn-chapter.html I agree that it should be avoided when possible, but now I need to hack around deps.edn because of the lack of support

Alex Miller (Clojure team)14:04:15

you can make an alias that produces the boot classpath you need, then use clj -Spath to generate the classpath from it, so there is no need for manual jar downloading

Alex Miller (Clojure team)14:04:58

and then put that path in your :jvm-opts

kszabo14:04:46

clj -Spath would produce an absolute path to my main maven repo, which is hosted in my home directory

kszabo14:04:06

meaning the resulting :jvm-opts needs to be scripted on each machine

Alex Miller (Clojure team)14:04:51

an alternative would be to set :mvn/local-repo to fetch it into a subdirectory of the project, then use relative paths in the jvm-opts

kszabo14:04:19

wouldn’t that apply to all maven deps? I haven’t used that one yet

kszabo14:04:42

I don’t want to download maven again 😂

Alex Miller (Clojure team)14:04:11

you would just use this for what you need in the bootclasspath

kszabo14:04:20

thanks for the help

jaime21:04:41

I'm using clojure cli / deps.edn. Is there a way to define env vars following the 12 factor app? Looking into https://github.com/weavejester/environ but it seems like it does not support deps.edn (for instance, if your using lein. you can have .lein-env)

seancorfield21:04:53

@jaime.sangcap (System/getenv "varname") is all you need to get an environment variable's value so I'm not sure what you're asking in the context of CLI/`deps.edn`?

seancorfield21:04:38

Perhaps "Can you have environment variables in your deps.edn?" No. It's a pure EDN file, not executable code, and has no substitutions made.

jaime21:04:01

I'm wondering if there is library that can load env var from file. And you can configure where the file is in the deps.edn. Right now I'm only using intellij to set env vars. What I'm thinking is there should be a example file (checkin to version control) that has all the required env var Then locally, the library will check the example file against your env file for missing env var

jeff.terrell15:04:59

This might be at least partially what you're looking for: https://github.com/yogthos/config

jaime16:04:56

cool! Yes I think can use this. Thanks 🙂

👍 4
jaime21:04:01

Before loading them and throw error is you missed to set something

seancorfield21:04:14

Sorry, I have no idea what you mean by any of that.

jaime21:04:33

Thanks! I think I'm mixing different things

seancorfield21:04:44

Environment variables are set at the O/S level before a process is started -- I would imagine IntelliJ is setting the environment variables before starting the REPL or run process.

seancorfield21:04:44

You can't set environment variables from inside a process. You can set JVM properties tho'...

seancorfield21:04:01

BTW environ is just a library. It can be used from any process run by CLI/`deps.edn`.

seancorfield21:04:21

It just happens to have existing plugins for lein and boot that call it in particular ways.

seancorfield21:04:08

(but I would caution you against storing anything in deps.edn that isn't part of the official syntax -- deps.edn is not intended to be a "general configuration file -- which project.clj and build.boot tend to be)