Fork me on GitHub

I try to override the maven root directory:

# ~/.polylith/config.edn
{:color-mode "dark"
 :m2-dir "/Users/endymion/kaboom"
And poly sees this:
poly ws get:settings:m2-dir
However when I run the unit tests poly still downloads files to the ~/.m2 directory
poly test since:previous-release
This will download to ~/.m2 and not to the /Users/endymion/kaboom Is there something I do wrong?


The poly tool doesn’t configure Maven itself. This is only a way to tell it where the Maven root directory lives (and is used by the libs command). So if it lives somewhere else than ~/.m2 or if you need to hard code a path (this was the reason it was introduced in the first place) then you can configure it in the ~/.polylich/config.edn file.


Does this mean that :m2-dir is not used by the test command? How can I make the test command use a custom maven root dir?


I guess I work around it by symlinking


The test command uses tools.deps so if you want to move ~/.m2 somewhere else, you have to tell tools.deps where it lives (I don’t know how to do that, or if it’s possible).


Symlinks work for my use case so np for me anymore. I digged into toe polylith code and found

(defn ->config
  "Converts back to the tools.deps format.
   Tools.deps only resolves src depenencies (:deps) but not test
   dependencies (:aliases > :test > :extra-deps) which is the reason
   we merge :src and :test."
  [{:keys [lib-deps maven-repos]}]
  {:mvn/repos maven-repos
   :deps (into {} (map key-as-symbol (merge (:src lib-deps)
                                            (:test lib-deps))))})
(defn resolve-deps [project is-verbose]
  "Resolves which library versions that are used by the given project."
  (let [config (->config project)
        _ (when is-verbose (println (str "# config:\n" config) "\n"))]
    (tools-deps/resolve-deps config {})))
Which basically calls tools-deps/resolve-deps with a custom constructed config that does not include a :mvn/local-repo . When I hardcode :mvn/local-repo "/Users/endymion/my-m2 stuff gets downloaded to my folder.


Okay, well spotted! If you want, you can create an issue and I will have a look at it.


I’ve fixed the problem and merged it to Even though you have solved it already, it would be great if you could test it 🙂.