How can I configure my project.clj so that Leiningen finds my sources under a non-standard directory structure?

StackOverflow https://stackoverflow.com/questions/1785093

  •  21-09-2019
  •  | 
  •  

Question

It seems Leiningen's compile task looks for source packages to start immediately under the /src directory. I use both Java and Clojure in my project, so my /src directory looks like this:

/src/java/myapp
/src/clojure/myapp

Right now Leiningen is looking for /src/myapp and it's failing out during the compile.

Related, I'd like to know how to manually add directories to the classpath for Leiningen's compile and repl tasks. For example, Enlive's deftemplate function will search the classpath for a named template file. Adding /templates to the classpath would be required for my project to build and run properly.

Was it helpful?

Solution

This will be fixed in Leiningen 1.0 which is currently looking good for a release in the next week or so. Hopefully someone writes a javac plugin for Leiningen too; it should be easy to write as Lein bundles ant so you could just reuse ant's javac task.

OTHER TIPS

Have you tried setting the :root value in your project file?

Looking at the source code for the compile command, it will process only Clojure files anyway and will look for these files under (file (:root project) "src") , so you could set :root to point to "src/clojure/" but would still need a symlink so that "src/clojure/src/" exists...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top