22

I have a lein project in one directory, and instead of using the .jar that gets downloaded when I run

> lein deps

I want to use the source from a cloned github repository (It has recent fixes not in the current jar). What is the canonical way to do this with leiningen?

Here is my project file:

(defproject oroboros "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.2.1"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [clojure-source "1.2.1"]
                 [overtone "0.3.0"]
                 [penumbra "0.6.0-SNAPSHOT"]]
  :native-dependencies [[penumbra/lwjgl "2.4.2"]]
  :dev-dependencies [[native-deps "1.0.5"]
                     [swank-clojure "1.4.0-SNAPSHOT"]])

I want to use the overtone repo from github, rather than the one from clojars.

https://github.com/overtone/overtone

Is this possible?

Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
prismofeverything
  • 8,799
  • 8
  • 38
  • 53

2 Answers2

23

You can use checkout dependencies. From Leiningen's README:

Q: I want to hack two projects in parallel, but it's annoying to switch between them.

A: Use a feature called checkout dependencies. If you create a directory called checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. That means changes in the dependency will be visible in the main project without having to go through the whole install/switch-projects/deps/restart-repl cycle. Note that this is not a replacement for listing the project in :dependencies; it simply supplements that for tighter change cycles.

mtyaka
  • 8,670
  • 1
  • 38
  • 40
  • Adding a checkouts dir and linking the repo in did not work. Is there more I need to do here? I don't see this feature described elsewhere. – prismofeverything Sep 14 '11 at 08:34
  • 2
    if you add a link in the checkouts dir, you don't need to specify the dependency in the project.clj file. in contrast with what the docs imply, you should REMOVE the references from the project.clj file, otherwise lein deps will still break. – Joost Diepenmaat Sep 14 '11 at 10:50
  • Joost is correct, you should remove overtone from the :dependencies in project.clj. – mtyaka Sep 14 '11 at 12:13
  • Hmmm... that seems to find the live.clj file, but still fails for midi? java.io.FileNotFoundException: Could not locate midi__init.class or midi.clj on classpath: (live.clj:1) – prismofeverything Sep 15 '11 at 22:09
  • 5
    Actually Joost is wrong, you need to keep the dependency in project.clj. Checkout dependencies are supplemental to regular dependencies; they do not replace them. Two reasons: 0) they are not transitive and 1) they are opt-in; other people may want to hack on the project without setting up checkouts. –  Sep 15 '11 at 22:36
  • 3
    @technomancy, what if your dependency isn't available anywhere besides checkouts? (no clojars, local maven repo, etc) – Jeb Sep 02 '13 at 06:42
1

Back when I was using lein I simply put symlinks in my project directory to the checked out Overtone source dir.

I use cake for my Overtone hacking these days which has support for adding external projects to the class path. You just need to add the path to project.classpath in your project's .cake/config file:

project.classpath = /Users/sam/Development/improcess/lib/overtone/src:
Sam Aaron
  • 402
  • 2
  • 6