0

I have two questions regarding dependencies in Clojure project.

  1. Is there something like :dev-dependencies or :test-dependencies so that I don't have to download them all on lein run? So until I run my tests I don't need to have these extra libraries.

  2. Can I load dependencies in one file and require this one file in an another file? I'd like to have something similar to:

    ; dependencies.clj
    ; ...
    
    (:require [clj-http.client :as client]
      [clj-http.fake   :refer :all]
      [clojure.test   :refer :all]))
    
    
    ; some-file.clj
    ; ...
    
    (:require [dependencies :refer :all[)
    
Kamil Lelonek
  • 14,592
  • 14
  • 66
  • 90
  • You might be able to use `load-file` for #2; I haven't tried it using it in this way. This is a non-standard strategy, and I think people would tell you not to do it, but if it works, I'm not sure why it would actually be bad. – Mars Jun 06 '15 at 05:53

2 Answers2

3

1) Yes, Leiningen offers profiles for just these purposes

2) No, referals from one namespace are not "inherited" between namespaces. You can't express "I want to refer to everything in this namespace, that some other namespace refers"

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • Here is the explanation: http://blog.8thlight.com/kevin-buchanan/2014/12/08/organizing-your-clojure-environment-and-logs-with-leiningen.html – Kamil Lelonek Jun 06 '15 at 12:10
2

Regarding your point 2, Potemkin can help you do this. Potemkin is especially useful if you have several namespaces implementing the functionality of a library, but then want to present a single namespace to users of the library.

bsvingen
  • 2,699
  • 14
  • 18