Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

clojure lein: How do I include source from another directory in my project?

Tags:

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?

like image 775
prismofeverything Avatar asked Sep 14 '11 04:09

prismofeverything


2 Answers

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.

like image 119
mtyaka Avatar answered Sep 19 '22 20:09

mtyaka


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:
like image 41
Sam Aaron Avatar answered Sep 18 '22 20:09

Sam Aaron