feeding leiningen a local JAR file

2,012 views
Skip to first unread message

Dick Davies

unread,
Nov 21, 2012, 6:47:30 AM11/21/12
to clo...@googlegroups.com
I've got a couple of projects that need a newer version of a JAR
than is available in Maven.

Is there any support/syntax in project.clj that will allow me to point
at a local JAR file?

Also, is it possible to 'override' a given dependency to favour a local JAR
over the 'official' maven one?

[ specifically, I'm trying to use clj-xmpp which uses the SMACK XMPP
libraries under the hood, and the maven shipped version won't authenticate
against our ejabberd ]

Jim foo.bar

unread,
Nov 21, 2012, 7:00:24 AM11/21/12
to clo...@googlegroups.com
On 21/11/12 11:47, Dick Davies wrote:
> Also, is it possible to 'override' a given dependency to favour a local JAR
> over the 'official' maven one?

just install the jar into your local maven repo (~/.m2/) (with
identifiable name) and then pull it from whatever project you want. I
think Leiningen will look first in your .m2 dir and only if it cannot
find the jar it will ask maven, clojars etc etc...am I right?

Jim

Shantanu Kumar

unread,
Nov 21, 2012, 7:36:20 AM11/21/12
to clo...@googlegroups.com, rasp...@hellooperator.net


On Wednesday, 21 November 2012 17:17:40 UTC+5:30, Dick Davies wrote:
I've got a couple of projects that need a newer version of a JAR
than is available in Maven.

Is there any support/syntax in project.clj that will allow me to point
at a local JAR file?

Also, is it possible to 'override' a given dependency to favour a local JAR
over the 'official' maven one?


Consider lein-localrepo; give the JAR a different version number: https://github.com/kumarshantanu/lein-localrepo


Shantanu

Dick Davies

unread,
Nov 21, 2012, 8:45:03 AM11/21/12
to clo...@googlegroups.com
Thanks, that's helpful to know (I was a java dev a long time ago,
before Maven took over
the world), but really I wanted to isolate this hack to a specific
project directory, rather
than globallly.
> --
> 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

David Williams

unread,
Jun 7, 2013, 10:37:46 PM6/7/13
to clo...@googlegroups.com, rasp...@hellooperator.net

Niels van Klaveren

unread,
Jun 8, 2013, 2:50:25 AM6/8/13
to clo...@googlegroups.com, rasp...@hellooperator.net
Leiningen uses the pomegranate library to manage dependencies and classpath. You can use this library from your project (or even the REPL) to load jars or put extra directories on the classpath, if you don't want to put them in your local repo.

Something like:

(require 'cemerick.pomegranate :as pom)
 (pom/add-classpath "/path/to/lib/dir/")

should do the trick.

Jay Fields

unread,
Jun 8, 2013, 2:10:48 PM6/8/13
to clo...@googlegroups.com, rasp...@hellooperator.net
David Chelimsky recently released: https://github.com/dchelimsky/lein-expand-resource-paths

Plínio Balduino

unread,
Jun 8, 2013, 2:15:26 PM6/8/13
to clo...@googlegroups.com
I'm using the localrepo plugin.
> --
> --
> 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/groups/opt_out.
>
>

Korny Sietsma

unread,
Jun 9, 2013, 3:50:41 AM6/9/13
to clo...@googlegroups.com, rasp...@hellooperator.net
That looks very helpful, thanks.  I've been bitten by this hard in the past - I wanted to play with a few different Processing jars in Quil, none of which had Maven versions; and even using lein-localrepo, it was excessively complex to add these jars to my local maven repo just so I could play with them.

- Korny


--
--
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/groups/opt_out.
 
 



--
Kornelis Sietsma  korny at my surname dot com http://korny.info
.fnord { display: none !important; }
Reply all
Reply to author
Forward
0 new messages