leiningen

What is an elegant way to set up a leiningen project that requires different dependencies based on the build platform?

不打扰是莪最后的温柔 提交于 2019-11-29 01:18:53
问题 In order to do some multi-platform GUI development, I have just switched from GTK + Clojure (because it looks like the Java bindings for GTK never got ported to Windows) to SWT + Clojure. So far, so good in that I have gotten an uberjar built for Linux. The catch, though, is that I want to build an uberjar for Windows and I am trying to figure out a clean way to manage the project.clj file. At first, I thought I would set the classpath to point to the SWT libraries and then build the uberjar.

How to run .clj file as a script using leningen?

徘徊边缘 提交于 2019-11-28 17:26:12
问题 This is the second question after Is there a standalone Clojure package within Leiningen? For example, I have a file hello_world.clj , and I can run it using java -cp clojure.jar clojure.main hello_world.clj . Since lein already contains Clojure (because I can run lein repl directly), is there a way to do the same thing like lein script hello_world.clj by lein? 回答1: use lein-exec plugin, example from readme.md (updated with "lein" instead of "lein2") cat foo.clj | lein exec lein exec -e '

What's the difference between Cake and Leiningen?

牧云@^-^@ 提交于 2019-11-28 16:11:07
What's the difference between Cake and Leiningen? This answer continues to get interest, presumably as a reference for Leiningen in StackOverflow so it is now significantly edited to update it for 2014. Leiningen and Cake merged back in 2011. Leiningen (version 2) is now the de facto Clojure automation tool. Leiningen is a build tool and dependency manager for Clojure which includes the ability to set up an interactive REPL with the appropriately configured classpath and with all java and clojure dependencies acquired in an automated manner from maven repositories and/or the community based

Best practices in building and deploying Clojure applications: good tutorials?

五迷三道 提交于 2019-11-28 15:53:17
I am new to Clojure, and am beginning to experiment with building an application. So far, everything I've seen about tutorials on compiling Clojure programs involves interactivity. For example, "load up the REPL and type (load-file "this-or-that") to run. This is fine, but it's not enough. I am so used to the edit-compile-run idioms of languages like C or Delphi, that I am instinctively driven to make edits, then hit "M-x compile". The problem is that "lein uberjar", which I understand is the equivalent to "make", is painfully slow to execute even for a hello world. So I'm going to have to

Any way to add dependency to lein project without REPL restart?

夙愿已清 提交于 2019-11-28 15:37:29
问题 What I do now is open project.clj, add dependency there, run lein deps restart repl, then use , require and so on. The thing is that I don't really like to restart repl because the startup time is slow and I have to reload my files again. So is there a better way to add dependency to lein project? without restarting the repl? 回答1: You can use Alembic, a dynamic classpath loader and dependencies resolver. The good thing is that it doesn't load all pomegranate dependencies. Add the following to

Getting the version of the current clojure project in the repl

一曲冷凌霜 提交于 2019-11-28 06:52:19
Is it possible to grab the project information within the clojure repl? For example, if there was a project defined: (defproject blahproject "0.1.2" ....) When running a repl in the project directory, is there a function like this? > (project-version) ;=> 0.1.2 Leiningen project files are just Clojure data :) (-> "/path/to/project.clj" slurp read-string (nth 2)) Paul Legato While you can parse project.clj yourself, this may be annoying. It's also a lot of work. Instead, you can just do: (System/getProperty "projectname.version") I use environ ( https://github.com/weavejester/environ ) which

How to upgrade nrepl version of leiningen?

冷暖自知 提交于 2019-11-28 06:43:13
I'm using leiningen and emacs + cider for clojure development. A few days ago, after I upgrade cider through emacs package manager, I'm getting the following warning message when I run M-x cider-connect or M-x cider-jack-in . ; CIDER 0.9.0snapshot (package: 20150222.137) (Java 1.8.0_31, Clojure 1.6.0, nREPL 0.2.6) WARNING: CIDER requires nREPL 0.2.7 to work properly user> The warning message clearly says that I have to upgrade nrepl to 0.2.7, however, I don't know how. I installed leiningen via brew , and it uses nrepl 0.2.6 . $ lein repl nREPL server started on port 53218 on host 127.0.0.1 -

Resources in Clojure applications

三世轮回 提交于 2019-11-28 03:27:20
I am using Leiningen in my Clojure project (a GUI application) and created a "resources" directory under the project root to hold images that my app uses. When I am running my app locally during testing, I fetch the images using the relative path "resources/logo.png", and this works fine. But when I build an uberjar using Leiningen, Leiningen puts the files from the resources folder in the JAR's root folder, so my references to resource files don't work anymore. What is the correct way to access resources like this using Leiningen? The previous answerer (skuro) pointed out that I need to get

Could not locate clojure/core/async__init.class or clojure/core/async.clj on classpath

☆樱花仙子☆ 提交于 2019-11-28 03:26:03
问题 Does anyone know why I'm getting the below error? I read through answers of similar questions, which recommended using Leiningen, which I've done below and still get the error. MacBook-Pro:~ xxx$ lein new app test Generating a project called test based on the 'app' template. MacBook-Pro:~ xxx$ cd test MacBook-Pro:test xxx$ lein repl nREPL server started on port 59623 on host 127.0.0.1 REPL-y 0.2.1 Clojure 1.5.1 Docs: (doc function-name-here) (find-doc "part-of-name-here") Source: (source

What's the difference between Cake and Leiningen?

北城以北 提交于 2019-11-27 19:56:12
问题 What's the difference between Cake and Leiningen? 回答1: This answer continues to get interest, presumably as a reference for Leiningen in StackOverflow so it is now significantly edited to update it for 2014. Leiningen and Cake merged back in 2011. Leiningen (version 2) is now the de facto Clojure automation tool. Leiningenis a build tool and dependency manager for Clojure which includes the ability to set up an interactive REPL with the appropriately configured classpath and with all java and