1

Unitl now, I know two ways to include my written libraries to a clojure project:

  • Symlink the library file to the src dictionary of my current project, then just require the ns, that is declared in the lib.
  • Making the library public via Clojars, then adding it to the lein dependencies of my current project. (and require the ns)

Is there a way in between? Say, I have developed something, that I don't want to publish yet, but I want to be able to easily require it in my repls and projects.

Anton Harald
  • 5,772
  • 4
  • 27
  • 61
  • What is wrong with your symlink approach? – jmargolisvt Feb 13 '16 at 15:21
  • Well, it's not wrong, but I'm looking for something easier. Say, I'm working on a library, it's almost done, but maybe not really tested. I just want to be able to require the lib "by one line" in any repl. – Anton Harald Feb 13 '16 at 15:40

1 Answers1

3

The easy way to do this is to run lein install in the lib, then require it as you would any other dependency using name and version in your project file.

noisesmith
  • 20,076
  • 2
  • 41
  • 49
  • That's what I was looking for. Just tried it - works. Could I also require the lib in any repl? – Anton Harald Feb 13 '16 at 16:05
  • You would need to add the jar to the classpath - there is the lib pomegranate that makes this possible at runtime (or alembic if you want more lein integration for runtime loading). – noisesmith Feb 13 '16 at 16:58