how to start lein with an existing clojure jar - clojure

I am trying to download/install/run clojure/lein and facing some initial problems. I am using cygwin on windows-7.
After downloading the latest clojure (1.8.0), the following step works fine:
java -cp clojure-1.8.0.jar clojure.main
Now I installed lein using the following steps (thanks to stackoverflow/18711805 for help):
download lein script into ~/bin , set filetype=unix
install wget and deps (see stackoverflow/18711805)
setenv HTTP_CLIENT "wget --no-check-certificate -O"
lein self-install
Now when I run "lein repl", I find that lein has downloaded another clojure version (1.7.0) and using that.
So, how can I ask lein to use my version of clojure (ie 1.8.0) and not the 1.7.0 ? Are there any extra environment variables to be set before the lein run?
Also, where does lein install its extra downloads, and how do I clean up that area?

"lein upgrade" did the trick, I got the hint from stackoverflow/24094597. Now when I run lein again I can see 1.8.0 (not my own install, but lein has installed this new version). But since I installed lein just a few minutes ago from scratch anyway, I am not sure why it did not install the latest version in the first place.

Related

Cannot get Leiningen commands to work with figwheel

After following the instruction set on https://leiningen.org/ to install Leiningen, I have managed to download the batch file and save it within a folder located in: C:\Users\Dylan\Bin\Lein.bat.
I then ran lein.bat self-install in CMD, which created the folder .lein:
At this point the Leiningen is added. I am then able to create a new project called tictactoe using the command lein new figwheel tictactoe -- --reagent in CMD and it creates the folder fine. However, the problem arises when I try to compile the tictactoe project, see below:
When I issue the lein new figwheel tictactoe -- --reagent command, it says
Generating fresh 'lein new' figwheel project.
Change into your 'tictactoe' directory
Install npm dependencies via 'npm install'
Then run 'lein figwheel'
Did you do the npm install?

Leiningen not working MacOs Mojave due to Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class

I am on Mojave and can't get leiningen to work.
I was using java 8, and then tried upgrading to 11 to no avail. Currently using:
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (buildb11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
I have tried copying lein to my /usr/local/bin and brew install but in both cases I get the error:
Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class, clojure/tools/nrepl/server.clj or clojure/tools/nrepl/server.cljc on classpath.
I had a similiar problem recently on macOS Mojave (10.14.6). The following command did the trick for me:
rm -rf .lein
However, before you run this line, please make sure that...
... you are in your home directory.
... .lein is a directory associated with your leiningen installation and nothing else!
... that you have a backup of any config files, custom packages, etc. that are associated with your leiningen installation.
Once you hit enter the .lein directory will be deleted. The directory will be rebuild when you start the repl via leinigen lein repl.

Installing leiningen 2 on Ubuntu

I have followed the instructions here:
leiningen.org
To install from the lein script. I now have:
~/.lein/self-installs/leiningen-2.4.3-standalone.jar
How do I now run leiningen? The instructions are not clear.
On ubuntu, its quite easy. Download executable file, make it executable and place it in system path.
$ wget https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
$ chmod +x lein
$ sudo mv lein /usr/local/bin
You can also move it any directory which is in system path.
$ lein -v
Leiningen 2.6.1 on Java 1.8.0_77 Java HotSpot(TM) 64-Bit Server VM
Posting this as it might help other users.
Follow the install instructions.
Please make sure the leiningen script that the install instructions is on your executable PATH.
The script is the entry point to leiningen commands, so it's still needed after the downloads are complete.
It takes care of setting up environmental variables, paths and everything else required to run leiningen, so you can use
lein <command>
instead of
java -cp <whatever>:~/.lein/self-installs/leiningen-2.4.3-standalone.jar ... clojure.main -m leiningen.core.main <command>
I got the same doubt. Solved it. By following the instructions everything will be set for you. Next run the previously used script lein.sh in bin for creating projects as below.
suppose ~/bin/lein.sh is your script location ,then
$ ~/bin/lein.sh new test-project
$ ~/bin/lein.sh --help
It will create the project in your bin folder it self.If you wish to access that lein.sh globally then include it in $PATH.
If you are using a linux distribution you can just download the leiningen script and move it to your /bin folder. Once you've done that you can execute lein command and it will be installed for you.
So from your terminal you can run:
$ curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > ~/lein
to download lein script to your root path. Then you set it as executable and move to your /bin folder
$ chmod x+a lein
$ sudo mv ~/lein /bin
$ lein
After you run the command lein from anywhere on your terminal the lein script will install leininge for your and you'll be able to use it normally.

How to speed jenkins build process while installing requirements using pip

I am using Jenkins CI for my django project. For Django-Jenkins integration I am using the django-jenkins app. In the build step of Jenkins I create a fresh virtualenv and install all the dependencies for each build using requirements file. However, this makes build extremely slow because a fresh copy of all the dependencies must be downloaded from a PyPI mirror, even if nothing has changed in the dependencies since the last build. So I started using the local caching built-in to pip by setting the PIP_DOWNLOAD_CACHE environment variable. But the whole build process is still painfully slow and takes more than 10 minutes. Is there any way I could speed up the whole process? Maybe by caching the compiled dependencies or something else?
Just only install a fresh virtualenv if your requirements.txt file changes. This can be done easily with some shell commands. We are doing something similar in one of our projects. In a Jenkins shell window we have (after svn up):
touch changed.txt
stat -c %Y project/requirements.txt > changed1.txt
diff -q changed.txt changed1.txt || echo "DO YOUR PIP --upgrade HERE!"
Why bother creating a fresh virtualenv each time you build? You should be able to create just one and simply activate it with . /path/to/venv/bin/activate as an 'Execute shell script' build step (assuming the use of linux here). Then, if you need to install a new dependency, you can activate the venv on your own and pip install the new package.

lein bootstrap: stable release of leiningen

Whenever I try to run lein bootstrap in the leiningen-core/ directory I always get the following message:
Please run "lein bootstrap" in the leiningen-core/ directory
with a stable release of Leiningen. See CONTRIBUTING.md for details.
I have the 2.2.0 script (which is a stable release). I have placed lein in my path. I am using
Linux (CentOS)
bootstrap is only necessary if you are building lein from source. If you downloaded a stable release, it Just Works. So you can do things like lein new, lein jar, etc, with no further setup. See the excellent README for details.
Set your path correctly. For example, put the lein script in your ~/bin and then add ~/bin to your path environment variable.