leiningen

Can't build a jar using Leiningen

末鹿安然 提交于 2019-12-10 15:46:17
问题 I'm trying to make a stand alone jar from my bare-bones Clojure project using the Leiningen plugin in Intellij's Cursive. To create the project, I just created the project.clj file, opened it, and Cursive offered to import it as a project. project.clj: (defproject WaterTimer "1" :description "A timer that reminds you to drink water" :main tone-producer/main) tone-producer.clj: (ns tone-producer (:require [general-helpers :as g]) (:import [javax.sound.midi MidiSystem Synthesizer MidiChannel])

how to load latest Clojure lib from git repository

痴心易碎 提交于 2019-12-10 15:24:20
问题 I'd like to use the latest development version of clojure.data.xml . I'm using Leiningen to manage dependencies. However, there is no SNAPSHOT version in the repository on Central. How can I easily load the latest version from GitHub? 回答1: The Maven Central repository does not hold snapshots. To use snapshots of the Clojure projects, you need to add the snapshot repository to your project. Full details here: http://dev.clojure.org/display/community/Maven+Settings+and+Repositories The key line

lein ring server-headless - only listen to localhost?

。_饼干妹妹 提交于 2019-12-10 15:16:00
问题 I have a Clojure project using lein-ring and the compojure web framework, which I start using the lein ring server-headless command. It produces the following output: 2014-06-28 19:37:50.236:INFO:oejs.Server:jetty-7.6.8.v20121106 2014-06-28 19:37:50.315:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:3000 Started server on port 3000 I kind of just realized that this is listening on 0.0.0.0 . A netstat -nltp confirms this: tcp6 0 0 :::3000 :::* LISTEN 31781/java Is it

Clojure Uberjar not loading resource file

丶灬走出姿态 提交于 2019-12-10 14:42:13
问题 I use lein uberjar to create a standalone jar of an application. When executing java -jar dataloader-0.1.0-SNAPSHOT-standalone.jar, it crashes with: Caused by: java.lang.IllegalArgumentException: Not a file: jar:file:dataloader-0.1.0-SNAPSHOT-standalone.jar!/configuration.json I load the file via: (ns dataloader.configuration (:gen-class) (:require [cheshire.core :refer :all] [clojure.java.io :as io])) (def data-file (io/file (io/resource "configuration.json"))) project.clj (defproject

How to configure leiningen's maven usage?

99封情书 提交于 2019-12-10 14:36:20
问题 My problem is that leiningen is not working on my computer. I get errors like these: Could not transfer artifact lein-ring:lein-ring:pom:0.4.5 from/to central (http://repo1.maven.org/maven2): Connection to http://repo1.maven.org r Could not transfer artifact lein-ring:lein-ring:pom:0.4.5 from/to clojars (https://clojars.org/repo/): Connection to https://clojars.org refused I think the problem is that I have a mirror configured in my settings.xml of my maven installation. How can I tell

How do I get emacs cider (clojure mode) to use my test environment variables when running tests?

為{幸葍}努か 提交于 2019-12-10 12:43:52
问题 I've set up separate database-url for development and test environments, and this works nicely when running my webapp in the REPL and from the lein test on the command line. Here's my profiles.clj : {:profiles/dev {:env {:database-url "wiki"}} :profiles/test {:env {:database-url "wiki-test"}}} And evidence of the right database instance being hit (I'm using CouchDB): ;; Running the site from the REPL: [info] [<0.12149.0>] 127.0.0.1 - - GET /wiki/home-page 200 [info] [<0.10353.0>] 127.0.0.1 -

How to require java classes in clojure/leiningen

二次信任 提交于 2019-12-10 09:47:09
问题 I am testing out Clojure/Java interop. I created a new Leiningen project and created this project.clj file with a few dependencies I'll be using: (defproject kente "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :license {:name "Eclipse Public License" :url "http://www.eclipse.org/legal/epl-v10.html"} :dependencies [[org.clojure/clojure "1.4.0"] [ring/ring-jetty-adapter "1.0.0-RC1"] [compojure "0.6.5"] [hiccup "0.3.7"] [cheshire "5.0.1"]] :java-source

How can I execute multiple lein tasks in one command?

£可爱£侵袭症+ 提交于 2019-12-10 08:07:23
问题 I'm new to leiningen. When I tried to execute following, $ lein clean jar I got Wrong number of arguments to clean task. Expected [] $ How can I execute multiple tasks in one command? 回答1: Yes, it is possible to execute multiple leiningen tasks in sequence with one command. Example: lein do clean, test 回答2: You can't do it at the command line directly, but you can with an alias in your project.clj file: :aliases {"go" ["do" "clean," "jar"]} So at the command line you would then be able to:

How to hot reload a namespace on file save in Leiningen REPL

天大地大妈咪最大 提交于 2019-12-10 02:24:01
问题 When using the leiningen REPL, is there a way to make a file or ns automatically reload in the repl on file save. Currently I reload the ns by typing the following in the repl - (use 'sample.ns :reload-all) . However can I have it reload automatically on file save ? 回答1: Clojure-Watch library does what you need. It observes a file and performs some action. In your case, an action would be to reload a namespace from that file. Also, it requires to write some initial code to launch the observer

Compojure: lein-ring in production?

让人想犯罪 __ 提交于 2019-12-09 18:03:01
问题 It seems that people sugget the use of lein-ring for a no-brainer deploy of a Compojure application. Isn't it just meant for development? I've benchmarked the same app running with lein-ring vs packed by leiningen with uberjar (executed with java -jar, it contains ring-jetty). To my surprise, the performance is even slightly better with lein-ring! Am I missing something? How can i keep on using lein-ring but avoid printing out stacktraces in case of exceptions and avoid checking for modified