Skip to content

Instantly share code, notes, and snippets.

@dfuenzalida
Created August 29, 2016 01:57
Show Gist options
  • Save dfuenzalida/252860b7652fb2d21a08559da63381f3 to your computer and use it in GitHub Desktop.
Save dfuenzalida/252860b7652fb2d21a08559da63381f3 to your computer and use it in GitHub Desktop.
Leiningen Multiple Mains
(ns manymains.alt
(:gen-class))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World from Alt!"))
(ns manymains.core
(:gen-class))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World from Core!"))
(defproject manymains "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.7.0"]]
;; :main ^:skip-aot manymains.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
@dfuenzalida
Copy link
Author

$ lein uberjar
Compiling manymains.core
Compiling manymains.alt
Created /tmp/manymains/target/uberjar+uberjar/manymains-0.1.0-SNAPSHOT.jar
Created /tmp/manymains/target/uberjar/manymains-0.1.0-SNAPSHOT-standalone.jar

$ java -cp target/uberjar/manymains-0.1.0-SNAPSHOT-standalone.jar manymains.core
Hello, World from Core!

$ java -cp target/uberjar/manymains-0.1.0-SNAPSHOT-standalone.jar manymains.alt
Hello, World from Alt!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment