ring

macrobartfast 2018-12-07T00:05:54.002500Z

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}})

2018-12-07T00:08:13.002600Z

What's in autojetty.core?

macrobartfast 2018-12-07T00:09:51.003100Z

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

2018-12-07T00:11:19.003300Z

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

macrobartfast 2018-12-07T00:11:22.003500Z

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.

macrobartfast 2018-12-07T00:12:59.003700Z

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.

seancorfield 2018-12-07T00:16:10.003900Z

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

seancorfield 2018-12-07T00:16:23.004100Z

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

macrobartfast 2018-12-07T00:16:30.004300Z

ok, stand by.

2018-12-07T00:17:06.004500Z

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.

seancorfield 2018-12-07T00:17:15.004700Z

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

macrobartfast 2018-12-07T00:17:33.004900Z

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

seancorfield 2018-12-07T00:17:37.005100Z

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

2018-12-07T00:18:04.005300Z

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

macrobartfast 2018-12-07T00:18:19.005500Z

thank you for your understanding (and time!).