Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

I'm running on Windows (not WSL) and have already got a working clojure / lein install based on the instructions here:

https://dev.to/adasomg/10-life-changing-minutes-with-clojure-windows-3ofl

Now I want to start with clojurescript based on the tutorial at https://www.learn-clojurescript.com. It wants to use clj as a build tool for clojurescript and it points to the install instructions on the main site which ultimately point here:

https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows

But that procedure assumes you don't have clojure already installed, which I do. Is there a way to get the clj tool standalone for windows?

2 Answers

+1 vote
by
selected by
 
Best answer

You are supposed to be able to get it working with the powershell tooling from cider:

https://docs.cider.mx/cider/basics/up_and_running.html#clojure-cli-options

I have had limited success here. When working on windows in the past, for day of datomic training (exclusively tools.deps....), I just launched a repl with the powershell version and an nrepl alias and connected to it from cider after launch via cider-connect. Worked okay.

There are some wrapped binaries like https://github.com/borkdude/deps.clj that could be supplied as an alternate command in theory. Hopefully the powershell variant just works now (at least with cider).

by
Thanks for your pointer to deps.clj.  It fits my needs perfectly.
0 votes
by

The clj command is for the Clojure CLI which is a different tool to lein and therefore a separate install.

Leiningen projects use a project.clj file to describe dependencies, plugins, etc.

Clojure CLI projects use a deps.edn file to describe dependencies etc.

They are two different ways to work with Clojure.

"Clojure" itself is really just libraries that you use as dependencies in projects -- you don't really "install" it. Since Clojure 1.9 there is no single JAR file you can download and use -- you must use Clojure as a dependency -- so you need to use some tooling that handles dependency management for you: either Leiningen or the Clojure CLI (or Boot, but you're not asking about that).

by
Yes, I understand all of that, I think.  IIUC the "clojure cli" is the clj command line tool I'm trying to get to work.  I already have clojure and leiningen working, but the clojurescript tutorial I'm using wants to use the clojure cli tools (clj).

And the only instructions I see to get the cli tools for windows includes installing the clojure jar AFAICT which I think should be redundant in my case because Leiningen already works.

What am I missing here?
by
You need to follow the steps to install the Clojure CLI (the "clj" command). That will use Clojure and install jars but don't worry about it. Both the Clojure CLI and Leiningen use the same Maven local repository to store jars, and they can use the same one (but they might by default use different versions). You're on the right path, just keep going.
by
edited by
Yup, that worked, but it turns out that it's a bit of a pain point for me because the tools are hosted in a powershell instead of the old fashioned windows command processor.  I'm used to hosting that flavor of shell within emacs so it would be a pain to set something else up for this use case only.  It's a shame there isn't something that more closely parallels "lein.bat" under windows so that users like me can do more of an "apples to apples" comparison with Leiningen.

Anyway, I'm sure I can get something working with clojurescript and lein; I was just hoping to understand this alternative toolchain a bit better as an educational exercise -- the overlapping and conflicting toolchains are a bit of a confusing mess.
by
(Edited -- accidentally double posted previous reply)
by
For what it's worth, I think the best development setup on Windows these days is to use WSL2 and run all the Clojure/Script stuff there -- because everything will "Just. Work." on Linux because that is what nearly all Clojure/Script projects target (macOS/Linux). I work with a 120k line Clojure code base on Windows that way, with Docker for Elastic Search, Redis, and Percona and everything works per all the tutorials/books. Windows itself has always been a second-class citizen in the Clojure world and you will find that quite a few of the tutorials and projects out there either won't work at all on Windows or will require workarounds for some things.
by
Yes, I've already hit those pain points with standard clojure as well.

I've been toying with the idea of WSL2, but then I read some nasty things about how it doesn't play nice when you're using a VPN, which is my constant work from home scenario these days.
by
I use a VPN to access our QA/production servers and haven't experienced anything strange with WSL2 -- I can access those servers over the VPN just fine from WSL2. Do you have links to articles about "nasty things"?
by
My first indication was the comment near the bottom of the page from pauljohn32 here:

https://adamtheautomator.com/windows-subsystem-for-linux/

Then googling "wsl vpn conflict" turns up quite a bit, including the following open issue on the wsl github page (first search result):

https://github.com/microsoft/WSL/issues/5068

After that I didn't dig any further to discern the exact details. Perhaps you can clarify the issue based on your personal experience and what you see there.
by
I just connected the Windows VPN to our server cluster (using the built-in VPN but it's Cisco stuff on the server-side), and I can still curl from WSL2 to any servers -- inside or outside the DMZ -- and I can launch google-chrome on WSL2 and interact with any sites I want, while the VPN is connected. I do not have /etc/wsl.conf so the /etc/resolv.conf file is auto-generated for me.

I'm using the latest WSL2 version on Windows 11 at this point (I've been using Insider builds of everything for just over seven years now). I think there was a point, shortly after WSL2 was introduced, where there were network-related problems but I haven't experienced any issues for ages.
by
Support appears to be hit and miss depending on the particular VPN
...