Installing Leiningen from a proxy – on Windows!

A quick note on how to do this, as I had a few issues.

Leiningen comes as a unix shell or windows batch script with some functionality embedded in it to download and install dependencies.  Actually, this is just a single uber-jar these guys have created containing clojure.  Download the script from:

https://raw.github.com/technomancy/leiningen/preview/bin/lein.bat

Put it somewhere sensible.  Add the folder containing it to your windows PATH.

Create LEIN_JAR as an environment variable and set it to a local foldername, somewhere where you will put this jar.

Now both the shell and batch scripts use wget, the unix command for HTTP requests.  So I installed cygwin to support this.  This is where the proxy provides a few problems.  Cygwin needs to know about it.

You need your proxy hostname and port number.

Create two files in your cygwin home folder, under the cygwin install, e.g. C:\apps\cygwin\home\<username>

.bashrc

export HTTP_CLIENT="wget --no-check-certificate -O" # 
proxy=http://<host>:<port>/
export http_proxy=$proxy
export https_proxy=$proxy
export HTTP_PROXY=$proxy
export HTTPS_PROXY=$proxy

.wgetrc

http_proxy=http://<host>:<port>/
https_proxy=http://<host>:<port>/
HTTP_PROXY=http://<host>:<port>/
HTTPS_PROXY=http://<host>:<port>/

Now start a cygwin shell (i.e. ‘bash’ from a commandline will do) and do lein self-install and all should be well.

 

Advertisements