On Fri, 4 Feb 2011 08:30:21 -0800 (PST)
Conrad <drc...@gmail.com> wrote:

> Hi everyone: Even though I'm an intermediate clojure user, I realize
> there's some basic things I just don't understand about JARs and
> Leiningen. It seems to me the answers to these questions would make
> great additions to the Leiningen FAQ (unless I'm the only one
> boneheaded enough not to be able to figure this stuff out on my
> own :-)
> 
> 1. What are the sources used for Leiningen JARs? Clearly, clojars.org
> is one of the sources, but it is able to also pull in jars not on
> clojars (such as "org.clojure/clojure 1.2.0") and I can't figure out
> how it decides where these are pulled from (admittedly, I haven't read
> the lein source, but it seems there should be documentation on this
> basic info somewhere without needing to study the source.)

It has a number of default repositories that it searches.
You can add more using the  :repositories keyword. It's a hash map,
key being the repo name you choose and the value the url.

> 
> 2. Maybe the fact that "org.clojure" appears in this package name
> means "retrieve this package from the site clojure.org". However,
> clojure is maintained at github, I don't understand why we'd want to
> pull anything from clojure.org. Is this JAR stored at clojure.org just
> as a static file in the root of the site or something? How would I
> know this file exists and that I can reference it?

If you need a jar file to be pumped by leiningen, you need access to its
pom.xml. You can either search Maven repositories or just google 
something like <libname> pom.xml. You look a the pom.xml,
you need [group/artifactid "version"] in the dependencies list in
your project.clj.

Then let leinigen search for it. If it does not find it then either you
need to add a repository that is not part of the default repo list
of leiningen or you may have to publish it in your own repo if the project
maintainers of the library you need did not publish it somewhere.

You can also publish it in clojars but you have to follow some rules
if it's not your own project.

> 
> 3. What is the correct way to know what version numbers to use when
> referencing JARs for Leiningen? For instance, how would I find know
> that I can use the JAR "org.clojure/clojure 1.2.0" but cant use the
> JAR "org.clojure/clojure 1.4.0"? How do I know when to append
> "SNAPSHOT" to the name? I mean, I know that "SNAPSHOT" basically means
> this is a branch under active development and not stable, but where
> can I find out what stable and snapshot versions of particular JARs
> are available? (I'm aware that clojars.org has a search feature, but
> surely that can't be the whole answer...)
> 

Welcome to the world of dependency management... Some but not all pom.xml
will have a section listing dependencies. Some will be flagged as required
while others are optional. Each dependency states it's group, artifact is
and version. Leiningen will pull these also.

With other libraries, you may have to refer to the project home site to find out
what extra components are needed and then add these to your dependency list.

> Thanks for any clarification on these questions- I hope the answers
> aren't so simple that I'll feel foolish for asking these things in the
> first place :-)
> 



-- 
Luc P.

================
The rabid Muppet

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to