1

I use a local library to do some development, but the firewall prevents alot of internet sites. Is there a way to download artifacts manually?

My project.clj is:

https://github.com/zubairq/coils/blob/master/project.clj?

Update

From the comments given I am understanding that the steps to take are:

1) Install Maven

2) Find out which jars are in my project (How can I do this based on my project.clj?)
yazz.com
  • 57,320
  • 66
  • 234
  • 385
  • 1
    You can download jar and install it using maven (see http://stackhttp://stackoverflow.com/questions/4955635/adding-local-jars-in-maven-projectoverflow.com/questions/4955635/adding-local-jars-in-maven-project ) – edbond Sep 05 '13 at 10:43
  • 1
    see also http://www.pgrs.net/2011/10/30/using-local-jars-with-leiningen/ – edbond Sep 05 '13 at 10:44
  • 1
    edbond, your link got broken http://stackoverflow.com/questions/4955635/adding-local-jars-in-maven-project – noisesmith Sep 05 '13 at 12:45

1 Answers1

8

Dependency Tree

In order to figure out which jars your project needs you can do:

$ lein deps :tree

Which will show you something that is called a "dependency tree". It will look similar to:

 [clj-time "0.5.0"]
   [joda-time "2.2"]
 [clojure-complete "0.2.3"]
 [org.myproject/some-proto "0.0.1-20130523.145830-9"]
   [org.flatland/protobuf "0.7.2"]
     [ordered-collections "0.4.0"]
     [org.flatland/schematic "0.1.0"]
     [org.flatland/useful "0.9.0"]
 [com.datomic/datomic-free "0.8.3862"]
   ...

Installing Jars with Lein

One simple way to install manually downloaded jars would be to use "lein-localrepo":

$ lein localrepo install [-r repo-path] 
                         [-p pom-file] 
                         <filename> 
                         <[groupId/]artifactId> 
                         <version>

Here are a couple of examples (given that you have downloaded the jars):

$ lein localrepo install foo-1.0.6.jar com.example/foo 1.0.6

$ lein localrepo install foomatic-1.3.9.jar foomatic 1.3.9

Take a look at the documentation for more features and examples.

Installing lein-localrepo

You can install lein-localrepo as a plugin by adding the following to your ~/.lein/profiles.clj:

{:user {:plugins [[lein-localrepo "0.5.2"]]}}

Lein Behind a Proxy Server

In case it is "ok" to use a proxy server, you can add it to ~/.lein/profiles.clj under jvm-opts

{:user {:jvm-opts ["-Dhttp.proxyHost=168.1.1.104" "-Dhttp.proxyPort=8080"]}}

where user is a profile name to use.

Or you can export http_proxy environment variable before launching lein.

tolitius
  • 22,149
  • 6
  • 70
  • 81
  • Great answer. I am still trying to get the local lein repository working – yazz.com Sep 08 '13 at 12:46
  • It still is not working as now I have another problem, Lein will not self install behind the firewall. I will award you the prize anyway, as I think I will be trying for quite a while to get this working – yazz.com Sep 09 '13 at 08:25
  • The error I get when trying to self-install leiningen is: Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (407) Proxy Authentication Required." – yazz.com Sep 09 '13 at 13:06
  • When I do lein localrepo install I get an error: "Could not transfer artifact lein-newnew:lein-newnew:pom:0.3.5 from/to central (http://repo1.maven.org/maven2): Connection to http://repo1.maven.org refused" – yazz.com Sep 11 '13 at 10:53
  • `http_proxy` doesn't work for me, but `https_proxy` does. – whatacold Aug 28 '21 at 14:32