Project-level Leiningen Plugin

只谈情不闲聊 提交于 2019-12-03 11:29:46
DanLebrero

The short answer is "no", but it is still fairly easy to define a project level task: Add :eval-in-leiningen true to your defproject definition and move the task definition to src/leiningen/foo.clj.

You can do this by using .lein-classpath to point to a directory outside of src containing the tasks. For example, if you have the plugin in src/leiningen/foo.clj, you can do, at the project root:

$ mkdir tasks
$ mv src/leiningen tasks/
$ echo tasks > .lein-classpath

The reason you might want to avoid :eval-in-leiningen true is that it has some funny behaviors when you're trying to do AOT compilation for a main class. Specifically, you get:

Compilation failed: java.io.IOException: No such file or directory, compiling:(testproj/core.clj:1)

When trying to compile/run a even a simple test example. More information at:

https://github.com/technomancy/leiningen/issues/769

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!