Fork me on GitHub
#ring
<
2018-12-07
>
macrobartfast00:12:54

I found something odd or don't understand something... a repl started via lein repl in an untouched app created with 'lein new app <appname>' and which includes the following dependencies auto-starts jetty as a process: (defproject autojetty "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.8.0"] [ring/ring-defaults "0.3.2"] [ring/ring-jetty-adapter "1.7.1"]] :main ^:skip-aot autojetty.core :target-path "target/%s" :profiles {:uberjar {:aot :all}})

weavejester00:12:13

What's in autojetty.core?

macrobartfast00:12:51

(ns autojetty.core (:gen-class)) (defn -main "I don't do a whole lot ... yet." [& args] (println "Hello, World!"))

weavejester00:12:19

There's nothing there that should start Jetty. Perhaps you have some sort of plugin starting it? How do you know Jetty has started?

macrobartfast00:12:22

I couldn't figure out why a jetty process was starting with every start of the app I am working on, so I started removing things one by one and ended up with those two deps and nothing else. I then created a new project, included them, and got the result.

macrobartfast00:12:59

so, to reproduce: lein new app autojetty add [ring/ring-defaults "0.3.2"] and [ring/ring-jetty-adapter "1.7.1"] to the dependencies in project.clj, and then run 'lein repl'; ps aux | grep jetty will show a new process; quitting the repl will stop that process.

seancorfield00:12:10

Are you sure that's not just the Java process that is running the REPL itself?

seancorfield00:12:23

I do not see Jetty starting up with your code as-is.

weavejester00:12:06

I can't replicate it either. There is a process with "jetty" in the command, but that's because the dependency is on the classpath setup by Leiningen.

seancorfield00:12:15

ps aux | fgrep jetty shows me the Java processes that Leiningen starts -- as expected, because your project has autojetty in the name.

macrobartfast00:12:33

I suspect that's it. I'm pretty embarrassed.

seancorfield00:12:37

(and the classpath for that process also includes a JAR with jetty in the name)

weavejester00:12:04

It's an easy mistake to make if you're not familiar with Leiningen and Java classpaths.

macrobartfast00:12:19

thank you for your understanding (and time!).