Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move checkout deps documentation to the tutorial, expand it with exam…

…ples, change wording
  • Loading branch information...
commit 12856b5c19019feb650e1233b3c6a832a514d023 1 parent 329b4b7
@michaelklishin michaelklishin authored
Showing with 49 additions and 12 deletions.
  1. +2 −12 doc/FAQ.md
  2. +47 −0 doc/TUTORIAL.md
View
14 doc/FAQ.md
@@ -20,18 +20,8 @@
the [s3-wagon-private](https://github.com/technomancy/s3-wagon-private) plugin.
**Q:** I want to hack two projects in parallel, but it's annoying to switch between them.
-**A:** 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's source code will be visible in the main project without
- having to go through the whole
- install/switch-projects/deps/restart-repl cycle, and the copy in
- `checkouts` will take precedence over the dependency declared in
- project.clj. Note that this is not a replacement for listing the
- project in your main project's `:dependencies`; it simply
- supplements that for convenience. There is no special handling of
- subproject dependencies; if you change them you will need to `lein
- install` the subproject again.
+**A:** Leiningen provides a feature called *checkout dependencies*. See the [tutorial](https://github.com/technomancy/leiningen/blob/preview/doc/TUTORIAL.md)
+ to learn more.
**Q:** Is it possible to exclude indirect dependencies?
**A:** Yes. Some libraries, such as log4j, depend on projects that are
View
47 doc/TUTORIAL.md
@@ -197,6 +197,53 @@ You can add third-party repositories by setting the `:repositories` key
in project.clj. See the
[sample.project.clj](https://github.com/technomancy/leiningen/blob/preview/sample.project.clj).
+
+### Checkout Dependencies
+
+Sometimes it is necessary to develop two projects in parallel but it is very inconvenient to run `lein install`
+in one of them all the time.
+
+Leiningen provides a solution called *checkout dependencies* (or just *checkouts*). To use it, create a
+directory called `checkouts` in the project root, like so:
+
+ .
+ |-- project.clj
+ |-- README.md
+ |-- checkouts
+ |-- src
+ | `-- my_stuff
+ | `-- core.clj
+ `-- test
+ `-- my_stuff
+ `-- core_test.clj
+
+Then, under the checkouts directory, create symlinks to projects you need following a simple convention.
+If you develop a library with artifact id `superlib2`, symlink `checkouts/superlib2` to its local repository.
+In case of `megacorp/superlib3`, symlink `checkouts/superlib3`:
+
+ .
+ |-- project.clj
+ |-- README.md
+ |-- checkouts
+ | `-- superlib3 [link to ~/code/oss/superlib2]
+ | `-- superlib3 [link to ~/code/megacorp/superlib3]
+ |-- src
+ | `-- my_stuff
+ | `-- core.clj
+ `-- test
+ `-- my_stuff
+ `-- core_test.clj
+
+In other words, Leiningen takes artifact id of a dependency and looks it up under the `checkouts` directory and
+if such directory exists, it is prepended to classpath and will be available to load.
+
+Libraries located under the `checkouts` directory take precendence over libraries pulled from repositories.
+Checkout dependencies must be managed by Leiningen, too.
+
+The checkouts feature is not transitive: in other words, Leiningen will not find checkout dependencies of
+a checkout dependency.
+
+
## Running Code
Enough setup; let's see some code running. Start with a REPL

0 comments on commit 12856b5

Please sign in to comment.
Something went wrong with that request. Please try again.