Leiningen: referring to another project on local disc

510 views
Skip to first unread message

Simon Brooke

unread,
Apr 6, 2014, 9:16:37 AM4/6/14
to clo...@googlegroups.com
I'm trying to reference one of my leiningen projects from another, and not succeeding. My error must be simple and obvious...

Essentially the projects 'poker' and 'testgen' are both in /home/simon/workspace, and both are standard leiningen projects using just the default project template. I've done 'lein uberjar' in testgen, so there are the following jars:

simon@engraver:~/workspace/poker$ ls -l /home/simon/workspace/testgen/target/
total 3588
drwxr-xr-x 2 simon simon    4096 Apr  2 20:04 classes
-rw-r--r-- 1 simon simon       5 Apr  6 00:06 repl-port
drwxr-xr-x 2 simon simon    4096 Apr  2 20:04 stale
-rw-r--r-- 1 simon simon   11226 Apr  6 00:10 testgen-0.1.0-SNAPSHOT.jar
-rw-r--r-- 1 simon simon 3646079 Apr  6 00:10 testgen-0.1.0-SNAPSHOT-standalone.jar

In poker/project.clj I've done the following (added lines highlighted):

(defproject poker "0.1.0-SNAPSHOT"
  :description "Poker scoring kata"
  :license {:name "Eclipse Public License"
    :repositories [["testgen" "file:///home/simon/workspace/testgen/target"]]
            :dependencies [[org.clojure/clojure "1.5.1"]
[testgen "0.1.0-SNAPSHOT"]
])

When I try to run lein repl, I get the following:

simon@engraver:~/workspace/poker$ lein repl
Could not find artifact testgen:testgen:jar:0.1.0-SNAPSHOT in clojars (https://clojars.org/repo/)
Could not find artifact testgen:testgen:jar:0.1.0-SNAPSHOT in testgen (file:///home/simon/workspace/testgen/target)
This could be due to a typo in :dependencies or network issues.

So clearly lein is failing to recognise the jar file(s) as the artefact it's looking for. What do I need to do differently? Do I need a pom file, and if so what should be in it?

Cheers

Simon

Softaddicts

unread,
Apr 6, 2014, 9:31:55 AM4/6/14
to clo...@googlegroups.com
Use lein install

This command will "install" your testgen jar in your local repo folder.
This local repo is hit first when searching for a dependency before escalating
to network repos if the dependency is not found there first.

No need for a uberjar.

Luc P.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
--
Softaddicts<lprefo...@softaddicts.ca> sent by ibisMail from my ipad!

Jony Hudson

unread,
Apr 6, 2014, 12:04:48 PM4/6/14
to clo...@googlegroups.com
Or, you could make a directory called 'checkouts' inside the poker project directory, and put a symlink in there to the testgen project directory. Lein will look in the checkouts directory before it looks to any repository. See  here:


This way is nice if you're going to work on both projects in parallel as you don't need to run lein install every time you change testgen.


Jony

Adrian Mowat

unread,
Apr 6, 2014, 2:26:50 PM4/6/14
to clo...@googlegroups.com
That's neat.  I didn't know you could do that.  Thanks

Simon Brooke

unread,
Apr 7, 2014, 6:47:44 AM4/7/14
to clo...@googlegroups.com
Many thanks. This solutions worked for me. I note that it also auto-builds a pom.xml!


On Sunday, 6 April 2014 14:31:55 UTC+1, Luc wrote:
Reply all
Reply to author
Forward
0 new messages