leiningen

leiningen with multiple main classes

大兔子大兔子 提交于 2019-12-03 07:14:30
问题 I'd like to have two main classes (or more) with leiningen, and then be able to choose which one at the java command line. For example I have: (ns abc (:gen-class)) (defn -main [] (println "abc")) (ns def (:gen-class)) (defn -main [] (println "def")) With a project.clj having: (defproject my-jar "0.0.1" :description "test" :dependencies [ ] :main abc) Then I build with lein uberjar , and run: java -cp my-jar-0.0.1-standalone.jar abc java -cp my-jar-0.0.1-standalone.jar def I get it that when

Leiningen: How to customize the location of the .m2 folder?

两盒软妹~` 提交于 2019-12-03 07:00:53
I would like to change the location of the .m2 folder where leiningen stores all dependencies (on Linux). Is it possible to achieve this? I've checked the source code of the lein.sh script and all environment variables but there's nothing which seems to point to $HOME$/.m2 For leiningen v2: Put a profiles.clj in ./users/name/.lein (or Linux equivalent) containing the following {:user {;Location of local repository :local-repo "Drive/Path" ;Location of locally installed jars ;(that can't be downloaded from public repo's) :repositories {"local" {:url "file://Drive/Path" :releases {:checksum

shutdown hook doesn't fire when running with “lein run”

两盒软妹~` 提交于 2019-12-03 06:03:49
I have the following code: (ns test-hook.core) (defn -main [] (.addShutdownHook (Runtime/getRuntime) (Thread. #(println "shutdown"))) (println "start") (doseq [i (range 1 6)] (Thread/sleep 1000) (println i))) and the following project.clj (defproject test-hook "1.0.0-SNAPSHOT" :aot :all :main test-hook.core :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.2.0"]]) when I run it with "lein run" the shutdown hook only gets executed on normal program execution, not when receiving SIGINT (Ctrl-C) the same code when ran outside of lein successfully executes the shutdown

Stopping infinite loops while running clojure tests in emacs with leiningen and swank/slime

走远了吗. 提交于 2019-12-03 05:52:45
In certain kinds of code it's relatively easy to cause an infinite loop without blowing the stack. When testing code of this nature using clojure-test, is there a way to abort the current running tests without restarting the swank server? Currently my workflow has involved $ lein swank Connect to swank with emacs using slime-connect , and switch to the the tests, execute with C-c C-, , tests run until infinite loop, then just return but one cpu is still churning away on the test. The only way to stop this I have found is to restart lein swank, but it seems like this would be a relatively

Can't launch `lein` REPL in Emacs

偶尔善良 提交于 2019-12-03 05:24:13
In Emacs, when using clojure-mode , I ought to be able to launch a REPL with C-c C-z . Whenever I try, though, I get the error: Searching for program: no such file or directory: lein I have lein installed in /usr/local/bin (via brew ) and /usr/local/bin is in my PATH (even Emacs says so, via eval-expression (getenv "PATH") ). What am I missing? Ah! The PATH environment variable isn't the end-all and be-all of emacs search paths. There's also the "exec-path". It apparently does mostly the same thing but not exactly . Anyway, adding: (add-to-list 'exec-path "/usr/local/bin") To my .emacs.d/init

Run tests from Clojure Repl and Leiningen

☆樱花仙子☆ 提交于 2019-12-03 04:09:58
问题 As a newbie to clojure, I have used leiningen to create a sample project with lein new app first-project which gave me this directory . ├── doc │ └── intro.md ├── LICENSE ├── project.clj ├── README.md ├── resources ├── src │ └── first_project │ └── core.clj ├── target │ └── repl │ ├── classes │ └── stale │ └── extract-native.dependencies └── test └── first_project └── core_test.clj Without modifying any files, I can lauch successfully the only failing test with lein test ... Ran 1 tests

How to clear the REPL in cider-mode?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 03:53:23
I am not meaning cleaning up the text output of REPL; I mean cleaning up all evaluated results in REPL. During developing, repeatedly C-c C-q and C-c M-j is low efficiency. UPDATE There may be some bad debug behaviour of mine. I am not sure how other people develop progs with CIDER, but I really need the functionality mentioned above. I guess other developers also encounter same problems as mine. For example, at the top of a clojure prog unit, I use declare to declare a function foo , which is used by another function bar , and foo is implemented after bar . Then, I C-c C-k , etc, and the prog

clojure/ring/jetty: I am using > lein ring server. How do I configure the jetty instance that gets instantiated?

时间秒杀一切 提交于 2019-12-03 01:05:08
When I was calling the jetty handler directly, I was able to pass in a configurator like so: (def header-buffer-size 8388608) (defn start [port] (ring/run-jetty (var app) {:port port :join? false :host "127.0.0.1" :configurator (fn [jetty] (doseq [connector (.getConnectors jetty)] (.setHeaderBufferSize connector header-buffer-size)))})) I had to do this because I kept getting a FULL HEAD error when posting. Now I refactored things to use > lein ring server directly, which gets called from the command line. > lein ring server This uses some configuration specified in my project.clj: :ring {

Deploying Clojure apps with Leiningen

你离开我真会死。 提交于 2019-12-02 22:53:45
This is my project.clj file so far: (defproject raj "0.0.1-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.3.0"]] :keep-non-project-classes true :main raj.core) And my core.clj file: (ns raj.core (:use raj.core)) (defn -main [& args] (println "Hello World!!!")) lein run -m raj.core displays the Hello World message just fine. So next I try lein uberjar and get Compiling raj.core Compilation succeeded. Created C:\Users\bobjones\IdeaProjects\raj/raj-0.0.1-SNAPSHOT.jar Including raj-0.0.1-SNAPSHOT.jar Including clojure-1.3.0.jar Created C:\Users\bobjones

Display complete dependency tree with Leiningen

拟墨画扇 提交于 2019-12-02 22:11:11
I understand that lein deps :tree displays a dependency tree of all the project dependencies (implicit and explicit). However, "each dependency is only shown once within a tree." I'd really like to see a tree where this wasn't the case, and that if libraries A and B require library X , library X shows up under both A and B . Does anyone know how to do this with lein or some other tool? You can generate Maven's POM out of Leiningen's project definition and then use Maven's dependency:tree plugin with a verbose option, like this: $ lein pom $ mvn dependency:tree -Dverbose=true This will list