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
@hifumi123 that doesn't seem accurate, but feel free to follow up in #tools-deps or #tools-build if you have more on that
ahh ~( is what it is, and java.lang potentially being required is the other thing I hadn't realized. tyvm guys
Having a CI profile setting :local-repo is one idea
I guess update-in as well but not sure how to combine it with a getenv
You can eval in from env vars in the project.clj.
This is similar to something I had setup for a similar case before.
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.There is support for this in the :mvn/local-repo key in the deps edn
And you can pass these dynamically on the command line with -Sdeps
clj -Sdeps โ{:mvn/local-repo โwhateverโ}โ
Or the do the right quotey thing with an env var there
This is for the Clojure CLI but maybe I misunderstood and you are using lein ?
Oh, we are in leinigen, my bad I probably just confused it all :)
@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
@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
the solution in the end was patching the build.clj file since tools.build does not pick up certain keys from Sdeps IME