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

+2 votes
in Tools by

I have a :test alias in my project, which includes :jvm-opts (as well as :extra-paths and :extra-deps). I call tools.build.api/create-basis with {:aliases [:test]} and then pass that basis to tools.build.api/java-command but that doesn't include those JVM options.

In order to pick up those JVM options, I needed to do this:

(defn run-tests
  (let [basis    (b/create-basis {:aliases [:test]})
        combined (t/combine-aliases basis [:test])
        cmds     (b/java-command {:basis     basis
                                  :java-opts (:jvm-opts combined)
                                  :main      'clojure.main
                                  :main-args ["-m" "cognitect.test-runner"]})
        {:keys [exit]} (b/process cmds)]
    (when-not (zero? exit)
      (throw (ex-info "Tests failed" {})))))

(so I have to use tools.deps.alpha/combine-aliases).

Is this expected? Should this be easier?

1 Answer

+1 vote
selected by