如何配置我的 project.clj 以便 Leiningen 在非标准目录结构下找到我的源代码?
Leiningen 的编译任务似乎会在 /src 目录下寻找源代码包并立即启动。我在项目中同时使用 Java 和 Clojure,因此我的 /src 目录如下所示:
/src/java/myapp
/src/clojure/myapp
现在 Leiningen 正在寻找 /src/myapp,但在 /src/myapp 期间失败em>编译。
相关的是,我想知道如何手动将目录添加到 Leiningen 的 compile 和 repl 任务的类路径中。例如,Enlive 的 deftemplate 函数将在类路径中搜索命名模板文件。我的项目需要将 /templates 添加到类路径才能正确构建和运行。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将在 Leiningen 1.0 中修复,目前看起来很适合在下一个版本中发布一周左右。希望有人也为 Leiningen 编写一个 javac 插件;它应该很容易编写,因为 Lein 捆绑了 ant,因此您可以重用 ant 的 javac 任务。
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.
您是否尝试过在项目文件中设置
:root
值?查看编译命令的源代码,它只会处理 Clojure 文件,并且会在
(file (:root project) "src")
下查找这些文件,因此您可以设置:root
指向“src/clojure/”,但仍然需要一个符号链接,以便“src/clojure/src/”存在......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...