Lein not running my main function


#1

Lein run doesn’t seem to run my main. I get no output, just a migratus migration. I’m really stuck on this one.

Here’s my project.clj:

(defproject naac "0.1.0-SNAPSHOT" :dependencies [[org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.9.229"] [reagent "0.6.0"] [re-frame "0.9.2"] [compojure "1.5.0"] [yogthos/config "0.8"] [migratus "0.9.2"] [ring "1.4.0"] [com.layerware/hugsql "0.4.7"] [org.postgresql/postgresql "9.4.1207"]]

:plugins [[lein-cljsbuild “1.1.4”]
[migratus-lein “0.4.1”]]

:min-lein-version “2.5.3”

:source-paths [“src”]

:clean-targets ^{:protect false} [“resources/public/js/compiled” “target”]

:figwheel {:css-dirs [“resources/public/css”]
:ring-handler naac.handler/dev-handler}

:profiles
{:dev {:dependencies [[binaryage/devtools “0.8.2”]]
:plugins [[lein-figwheel “0.5.9”]]
:resource-paths [“resources/config”]}
}

:migratus {:store :database
:db ~(get (System/getenv) “DATABASE_URL”
“jdbc:postgresql://localhost:5432/jeff”)
:migration-dir “migrations”}

:cljsbuild
{:builds
[{:id “dev”
:source-paths [“src/cljs”]
:figwheel {:on-jsload “naac.core/mount-root”}
:compiler {:main naac.core
:output-to “resources/public/js/compiled/app.js”
:output-dir “resources/public/js/compiled/out”
:asset-path “js/compiled/out”
:source-map-timestamp true
:preloads [devtools.preload]
:external-config {:devtools/config {:features-to-install :all}}
}}

{:id           "min"
 :source-paths ["src/cljs"]
 :jar true
 :compiler     {:main            naac.core
                :output-to       "resources/public/js/compiled/app.js"
                :optimizations   :advanced
                :closure-defines {goog.DEBUG false}
                :pretty-print    false}}


]}

:main naac.server

:aot [naac.server]

:uberjar-name “naac.jar”

:prep-tasks [[“cljsbuild” “once” “min”] “compile”]
)

And my naac.server namespace file, server.clj

(ns naac.server (:require [naac.handler :refer [handler]] [config.core :refer [env]] [migratus.core :as migratus] [ring.adapter.jetty :refer [run-jetty]] [naac.db :refer [load-db!]]) (:gen-class))

(def db-config {:store :database
:db (get (System/getenv) “DATABASE_URL”
“jdbc:postgresql://localhost:5432/jeff”)
:migration-dir “migrations”})

(defn -main [& args]
(println args)
(doseq [a args]
(cond
(= a “migrate”)
(do
(println “Migrate database…”)
(migratus/migrate db-config)
(println “…Migration done.”))
(= a “rollback”)
(do
(println “Rollback database…”)
(migratus/rollback db-config)
(println “…Rollback done.”))
(= a “load”)
(do
(println “Load database…”)
(load-db!)
(println “…Load done.”))))

(if (> (count args) 0) (System/exit 0))

(let [port (Integer/parseInt (or (env :port) “3000”))]
(run-jetty handler {:port port :join? false})))


#2

Solved: source path needed “src/clj”.


#3

Awesome, I’m glad you solved it. :thumbsup: