1

I have a segregated Project in Clojure lets Suppose these three projects are inter dependent.

  1. Clojure-IO
  2. Clojure-Data
  3. Clojure-Calc The dependencies of the project are as follows

I tried to add both the project into my clojure root directory, and tried to run the same but Im getting error saying that : Unable to resolve symbol: k in this context

Dependecies of the projects are

project 2 and project 3 are dependent on project 1 so I required Project 2 and project 3 in project 1

Sufiyan Ansari
  • 1,780
  • 20
  • 22

1 Answers1

3

It sounds like you need to use lein-checkouts. Here is a detailed description. See also the documentation.

Basically, you make a directory named checkouts at the top level of your project directory (next to project.clj). Inside of checkouts, make symbolic links to the local top-level dirs for all dependency projects.

For example, I have a project car that depends on 2 other projects, engine and wheel. I structure the project like so:

> d car/checkouts/*            
lrwxrwxrwx 1 alan alan 17 Jun  6 21:40 car/checkouts/engine -> /home/alan/engine
lrwxrwxrwx 1 alan alan 17 Jun  6 21:40 car/checkouts/wheel -> /home/alan/wheel

Update 1: Symbolic links (aka symlinks) are created in linux using the ln -s command:

> cd car
> ln -s /home/alan/wheel
> ls -ldF wheel
lrwxrwxrwx 1 alan alan 17 Jun  6 21:40 wheel -> /home/alan/wheel

Now, project car will see any local edits to files for both engine and wheel projects (as well as its own source files, of course).

Update 2

For jar file dependencies, you need to use :resource-paths in your project.clj file. Please see this question. and this example.

Alan Thompson
  • 29,276
  • 6
  • 41
  • 48
  • In checkouts folder, I need to add a jar file or the entire project folder, I am using datomic schemas in Clojure-Data project. if am using folder then how am I suppose to add a dependencies in project.clj – Sufiyan Ansari Jun 28 '17 at 14:25
  • Do i have a create a flie to create a link between subproject and a main project. If yes the what would be the file extension.and how a i supposed to give a link – Sufiyan Ansari Jun 28 '17 at 14:42
  • In Linux systems you can just create a symlink (`ln -s`). In Windows you should use `mklink /j`. Just create the `checkouts` dir first, and then create the links inside that directory. – Wout Neirynck Jun 29 '17 at 06:34