Skip to content

Instantly share code, notes, and snippets.

@gja
Last active August 15, 2022 16:25
Show Gist options
  • Save gja/efa1a7beea9ecb52e906 to your computer and use it in GitHub Desktop.
Save gja/efa1a7beea9ecb52e906 to your computer and use it in GitHub Desktop.
Building a lein uberjar without any compilation
(ns simplequest.core)
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
package simplequest;
public class main {
public static void main(String argv[]) {
String[] newArgs = new String[argv.length + 2];
newArgs[0] = "-m";
newArgs[1] = "simplequest.core";
System.arraycopy(argv, 0, newArgs, 2, argv.length);
clojure.main.main(newArgs);
}
}
(defproject simplequest "0.1.0-SNAPSHOT"
:description "FIXME: example of lein ubjerjaring without compiling the app"
:url "gist.github.com/gja/efa1a7beea9ecb52e906"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.7.0"]]
:main ^:skip-aot simplequest.main
:target-path "target/%s"
# put the core.clj and the main.java in src/simplequest
:java-source-paths ["src"]
:profiles {:uberjar {:aot []}})
@danielcompton
Copy link

What Java command do you use to run this?

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