简体   繁体   中英

Bootstrapped Leiningen plugin development in Clojure

I am attempting to write a Leiningen plugin that is compatible with the latest release and next 2.0 version, but am having troubles running the plugin on itself. What I mean by this is that I would like to write the codes and then run lein foo to run the latest version of plugin code on the plugin code itself. My project.clj file is below:

(defproject foo "0.0.0"
  :description "simple version for experiment"
  :dependencies [[org.clojure/clojure "1.4.0"]
                 [fs "1.1.2"]]
  :source-path "src/clj")

In the src/clj/leiningen folder I have a simple foo.clj file that just calls the function in src/clj/bar/foo-test.clj that prints the contents of the project directory. However, whenever I run lein foo it says not able to find foo.clj on CLASSPATH. If I move all files from src/clj to src and remove :source-path directive then it runs the right thing in foo.clj but then complains about fs.clj not found on CLASSPATH. I would have hoped this would be easier without the need for adding the foo dependency to project.clj and lein install,deps,foo between changes, but that is currently only way I make it work.

Thank you for help!

According to: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md , :source-path is now :source-paths in Leiningen 2.0, and should contain a vector instead of a direct string.

Another potential error is that you don't have :eval-in-leiningen true in the project file. I believe that is necessary to inherit the CLASSPATH of leiningen itself. I'm not certain if that is triggering any problems with finding fs.clj though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM