leiningen

Resources in Clojure applications

寵の児 提交于 2019-11-27 19:17:15
问题 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

Java and Clojure with Leiningen

匆匆过客 提交于 2019-11-27 17:58:57
Is it possible to easily manage and compile native Java classes alongside Clojure in a project using leiningen? I am working at a pretty low level (with netty nio) and thinking that some of the plumbing classes would actually be easier to handle as raw java both in terms of constructing the code as well as performance. Alex Ott In Leiningen tutorial there is following statement For projects that include some Java code, you can set the :java-source-path key in project.clj to a directory containing Java files. Then the javac compiler will run before your Clojure code is AOT-compiled, or you can

Embed version string from leiningen project in application

◇◆丶佛笑我妖孽 提交于 2019-11-27 17:53:36
问题 I want to be able to query or embed the version string set by the leiningen project and display that value to user. Uses include displaying the version string from the CLI, or as a header in a ring application. Is this possible? 回答1: If you're running inside Leiningen using lein run or the like, it's available as a system property: (System/getProperty "myproject.version") . If you're producing a jar you need to read pom.properties . 回答2: I like technomancy's answer, but I had to go look up

How to reload a clojure file in REPL

血红的双手。 提交于 2019-11-27 16:38:00
What is the preferred way of reloading functions defined in a Clojure file without having to restart the REPL. Right now, in order to use the updated file I have to: edit src/foo/bar.clj close the REPL open the REPL (load-file "src/foo/bar.clj") (use 'foo.bar) In addition, (use 'foo.bar :reload-all) does not result in required effect, which is evaluating the modified bodies of functions and returning new values, instead of behaving as the source haven't changed at all. Documentation: load-file use Or (use 'your.namespace :reload) papachan There is also an alternative like using tools.namespace

Keeping dependency versions up to date in Leiningen projects

核能气质少年 提交于 2019-11-27 13:44:57
问题 Is there a simple way to find out what versions of dependencies are available using Leiningen? E.g., if I have a web app which depends on Hiccup and Compojure, how can I be sure that I'm on the latest version of each without going to the github page for each? NOTE: I use Ant and Ivy for building my Java projects, so I have limited knowledge of Maven - so please spell out (or provide Fine Links for me to read) any Maven concepts that Leiningen exposes to me which would help with this (I know

How to Reload files upon save when using swank+leiningen+emacs

亡梦爱人 提交于 2019-11-27 13:38:12
问题 I'm looking to set up slime+lein-swank to reload source files referenced from the repl when i save the file. currently i do this: edit file save file switch to repl (use :reload-all 'com.package.namespace) test stuff I want to not have to remember to do step 4. 回答1: You can use SLIME's C-c C-k before switching to the REPL, for slime-compile-and-load-file . It will prompt you to save the file if you haven't already. When it's done, the things which you've redefined should be available at the

How can I install Leiningen packages behind a firewall?

蓝咒 提交于 2019-11-27 07:28:27
问题 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: Dependency Tree In order to figure out which jars your project needs you can do: $ lein

Java and Clojure with Leiningen

吃可爱长大的小学妹 提交于 2019-11-27 04:15:28
问题 Is it possible to easily manage and compile native Java classes alongside Clojure in a project using leiningen? I am working at a pretty low level (with netty nio) and thinking that some of the plumbing classes would actually be easier to handle as raw java both in terms of constructing the code as well as performance. 回答1: In Leiningen tutorial there is following statement For projects that include some Java code, you can set the :java-source-path key in project.clj to a directory containing

Getting the version of the current clojure project in the repl

三世轮回 提交于 2019-11-27 01:33:25
问题 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 回答1: Leiningen project files are just Clojure data :) (-> "/path/to/project.clj" slurp read-string (nth 2)) 回答2: While you can parse project.clj yourself, this may be annoying. It's also a lot of work. Instead, you can just do: (System

How to upgrade nrepl version of leiningen?

情到浓时终转凉″ 提交于 2019-11-27 01:27:32
问题 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