In Leiningen versions 1.x.x I was able to define a lein foo
task valid only in a single project by putting the following in that project\'s project.clj
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