Fork me on GitHub
Joseph R Savoie21:10:01

I am trying for the first time. I have my build.clj (uberjar) from the guide and it builds the standalone jar but when I try to run the jar I get "no main manifest attribute, in C:\_Dev\atom\buildtools\target\lib1-1.1.2-standalone.jar". Do I need to modify my main program?

(ns hello
  (:require [java-time :as t]))

(defn time-str
      "Returns a string representation of a datetime in the local time zone."
        (t/with-zone (t/formatter "hh:mm a") (t/zone-id))

(defn run [opts]
      (println "Hello world, the time is" (time-str (t/instant))))


The opening paren is missing, but this is likely only a copy-paste mistake?


Also you need a (:gen-class) and a -main function for a jar to be invokable

Joseph R Savoie21:10:18

Yep, just a copy-paste mistake.

Joseph R Savoie22:10:55

Great... that makes sense thank you!

Joseph R Savoie22:10:45

Still getting "no manifest" use to build an uberjar. I see a "Hello" class now in my target/classes directory


@URBNXSM3L Are you specifying :main to the uber task in


Perhaps share your build.clj so we can see what you're actually running?

Joseph R Savoie22:10:02

(ns build
      (:require [ :as b]))

(def lib 'my/lib1)
(def version "1.2.4")
(def class-dir "target/classes")
(def basis (b/create-basis {:project "deps.edn"}))
(def uber-file (format "target/%s-%s-standalone.jar" (name lib) version))

(defn clean [_]
      (b/delete {:path "target"}))

(defn uber [_]
      (clean nil)
      (b/copy-dir {:src-dirs ["src" "resources"]
                   :target-dir class-dir})
      (b/compile-clj {:basis basis
                      :src-dirs ["src"]
                      :class-dir class-dir})
      (b/uber {:class-dir class-dir
               :uber-file uber-file
               :basis basis}))


You're missing :main in the uber call.


So it won't know what the main ns is.

Joseph R Savoie22:10:10


(b/uber {:class-dir class-dir
               :uber-file uber-file
               :basis basis :main "hello"}


You need to tell it which namespace contains your -main function.


OK, but it will need to be a symbol per the docs, not a string.


:main 'hello should work (although your hello ns as posted did not have -main in it)

Joseph R Savoie22:10:25

Yep, the original did not. trying again

Joseph R Savoie23:10:06

Yay! That was it. thx


I had the same question not long ago. Two issues: :main and the symbol. I wonder in the case of specifying :main perhaps the program can take both string and symbol without much trouble and there's not gonna be much ambiguity here.

Ngoc Khuat08:10:34

I had the same issue and fixed by adding :main to uber It was a bit confusing follow the bc it’s not clear how do we specify the entry point of the program. Should this be included in the tutorial?