interstar
interstar

Reputation: 27186

How do you specify the classpath with Leiningen?

In Clojure, I have a Leiningen project with my source in

/src/project/core.clj

I want to add a subdirectory to this. Eg.

/src/project/examples/example-one.clj

In my core.clj file I try to pull in from

project.examples.example-one

But lein compile still tells me

Could not locate project/examples/example_one__init.class or project/examples/example_one.clj on classpath: 

Do you have to explicitly update project.clj file if you add a subdirectory to your main code directory? (I don't see that the main code directory itself is given there explicitly.)

Upvotes: 2

Views: 1246

Answers (2)

lorthos
lorthos

Reputation: 427

if your namespace contains dashes, the corresponding file should contain underscores instead of those dashes. You can read about the reason in here:

why-does-clojure-convert-dashes-in-names-to-underscores-in-the-filesystem

Unless you add different source codes like Java, Groovy etc... by default lein will include all the namespaces in the src folder.

Upvotes: 7

interstar
interstar

Reputation: 27186

Ah ... seems I can't have a hyphen in file name?

Kind of weird for a Lisp dialect, now I've got used to using hyphens as the default separator in my function names.

Upvotes: 0

Related Questions