How can I install Leiningen packages behind a firewall?

3k views Asked by At

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?)
1

There are 1 answers

5
tolitius On

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.