Muakasan
Muakasan

Reputation: 86

Is there a way to add a second src folder to leiningen?

I am trying to generate documentation for my source code using a templating library.

Currently my directory structure looks like

---src

---test

---project.clj

I would like to make a third folder called docs, in addition to src and test, which will have my documentation related namespaces. I would like to only include the namespaces in src in my final uberjar. I tried simply adding a third folder. I ran the repl and then required my docgen namespace in the docs folder, but got the following error.

(require '[<>.<>.docgen :as docgen] :reload)

FileNotFoundException Could not locate <>/<>/docgen__init.class or foundry/schema/docgen.clj on classpath. clojure.lang.RT.load (RT.java:456)

Is there a way to add the docs folder to the classpath of a certain profile so it is not part of uberjar?

Upvotes: 2

Views: 552

Answers (1)

Muakasan
Muakasan

Reputation: 86

Solved:

Added a profile in my project.clj, with the source-paths key. I use the with-profile lein command with +docgen

:profiles {
    :docgen {
        :dependencies [[]]
        :source-paths ["docs"]
    }
}

Upvotes: 3

Related Questions