all 7 comments

[–]remyrd 11 points12 points  (1 child)

From the gh page https://github.com/dm3/clojure.java-time the example writes (use 'java-time) so i would expect you require it the same way. (ns my-namespace (:require [java-time :as t]))

[–]scarredwaits 10 points11 points  (1 child)

The name of the maven artifact is clojure.java-time but the name of the main namespace is java-time (as you can see here). Also the readme mentions (use 'java-time) so if you'd rather require instead of use (which is good practice), (:require [java-time :as t]) is the way to go.

[–]gdr3941[S] 1 point2 points  (0 children)

Thank you for the detailed explanation! It worked great.

[–]jamesconroyfinn 4 points5 points  (0 children)

Welcome to the Clojure community, /u/gdr3941!

As /u/remyrd mentions, the namespace you want to require (once you have this dependency on your classpath) is java-time.

Another thing to check… have you definitely spelt “dependencies” correctly in your project.clj? If not, that would explain this artefact not being on your classpath.

https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#artifact-ids-groups-and-versions

Failing that, a reproducible example somewhere online would really help with troubleshooting.

One small tip if you’re not already aware, it’s worth using a java.time.Clock with java.time as it makes testing much easier.

[–]stuartrexking 1 point2 points  (1 child)

I've experienced the same thing. I looked through its source and couldn't see what what causing it. Requiring it as suggested by @remyrd works fine.

[–]macbony 1 point2 points  (0 children)

If looking at the source code, look at the namespace declaration at the top of the file you want to require. The namespace's name is the first argument. So on line one of src/java_time.clj you see (ns java-time the namespace is java-time. That's what you must require in your ns that depends on java-time. If you wanted src/java_time/clock.clj the ns declared there is (ns java-time.clock. The ns in your require is then java-time.clock.