leiningen

John 2023-10-25T00:12:37.735909Z

I'm having a hard time setting up dep cache in CI. Unless I can embed some logic in the :local-repo key to check for an environment variable, I want to control it from the outside. export MAVEN_OPTS=-Dmaven.local.repo does not seem to be having an effect -- the resulting cache folder is empty at the end

Alex Miller (Clojure team) 2023-10-25T10:15:32.323919Z

@hifumi123 that doesn't seem accurate, but feel free to follow up in #tools-deps or #tools-build if you have more on that

John 2023-10-25T10:56:37.535929Z

ahh ~( is what it is, and java.lang potentially being required is the other thing I hadn't realized. tyvm guys

John 2023-10-25T00:16:20.875879Z

Having a CI profile setting :local-repo is one idea

John 2023-10-25T00:17:45.097319Z

I guess update-in as well but not sure how to combine it with a getenv

2023-10-25T01:45:17.623669Z

You can eval in from env vars in the project.clj.

2023-10-25T01:49:00.725539Z

This is similar to something I had setup for a similar case before.

2023-10-25T01:49:53.864729Z

You should also be able to update-in though if you wanted to go that route. Something like:

lein update-in : assoc :local-repo "$CUSTOM_LOCAL_REPO" -- <task>
Iโ€™d think.

Alex Miller (Clojure team) 2023-10-25T01:50:21.261079Z

There is support for this in the :mvn/local-repo key in the deps edn

๐Ÿ˜ฎ 2
Alex Miller (Clojure team) 2023-10-25T01:50:57.587559Z

And you can pass these dynamically on the command line with -Sdeps

Alex Miller (Clojure team) 2023-10-25T01:51:49.261189Z

clj -Sdeps โ€˜{:mvn/local-repo โ€œwhateverโ€}โ€™

Alex Miller (Clojure team) 2023-10-25T01:52:20.666919Z

Or the do the right quotey thing with an env var there

Alex Miller (Clojure team) 2023-10-25T01:53:07.932989Z

This is for the Clojure CLI but maybe I misunderstood and you are using lein ?

Alex Miller (Clojure team) 2023-10-25T01:53:37.837329Z

Oh, we are in leinigen, my bad I probably just confused it all :)

๐Ÿš€ 1
hifumi123 2023-10-25T03:36:01.369259Z

@mikerod you can also use lein change assoc :local-repo "path/to/somewhere" if you want to persist the changes to the project.clj file in case multiple commands are invoked separately during CI

๐Ÿ‘ 1
hifumi123 2023-10-25T03:37:17.951689Z

@alexmiller minor caveat: tools.build will not see that information unless you patch the code that creates a basis. I learned this the hard way when invoking clojure exactly as you described for a project that uses tools.deps

hifumi123 2023-10-25T03:38:03.764409Z

the solution in the end was patching the build.clj file since tools.build does not pick up certain keys from Sdeps IME